Windows ole word automatism

Gregor Kopp gk at cutcopy.com
Tue Nov 14 08:29:41 PST 2006


Hi guys !

I'm fresh to D and really happy about the easy syntax compared to C++.
I would like to do automation with winword on my job here.

First of all, a little Ruby code, so that you can see what I mean:

Code starts here:

require "win32ole"
@word = WIN32OLE.new('Word.Application') # initialize a new word
# next line: create a new file with the given template
@word.documents.add(File.expand_path("myownfiletemplate.dot"))
# next line: show word, because it would be hidden!
@word.Visible = 1
# search for text
@word.selection.find.text = "Text to Search"
@word.selection.find.execute
# after search (text will me marked) exchange "Text to Search" with
# "Replaced by this Text"
@word.selection.typetext "Replaced by this Text"

Code ends here



Das a similiar lib (like this win32ole lib from ruby) exist for the D 
language? I also tried to work with dfl it does have a module named 
dfl.wincom, but there is no usable documentation about it, and I really 
don't know if its the right module.

Greets, Gregor



More information about the Digitalmars-d mailing list