Robert Klemme wrote:
> On 18.01.2009 03:18, gregarican wrote:
>> 
>> I wound up writing a C# console program to do the work. I just
>> referred to ugly underbelly of all of the Word COM stuff and was able
>> to grab what I needed. It took awhile though, since my text was
>> contained within text frames. So I had to work with the
>> Document.Shapes property and whatnot.
> 
> I'd say that's pretty fast.  Good job!
> 
>> in a single language. But that's another fight for another day :-)
> May I suggest a different approach?  Since your primary step is pulling
> data from a relational DB using Ruby, you could as well do this: open
> the mail merge Word template, replace mail merge fields with text with
> special formatting (for example "<<<field name>>>" or whatever doesn't
> collide with RTF meta sequences).  Then you save this as RTF file (ASCII
> readable).  Now you only need to read in the mail template file from
> Ruby, do all the replacements and then write it out in Ruby again once
> for each record.  Sounds pretty simple IMHO.
> 
> Kind regards
> 
>   robert

FYI, a similar (though not necessarily better) solution using Find & 
Replace in Word is demonstrated here:

  http://rubyonwindows.blogspot.com/2007/11/find-replace-with-ms-word.html

Greg: If you're willing to share your C# code for automating Word, I, 
for one, would like to see it. Feel free to email me, if you like.

David

-- 
Posted via http://www.ruby-forum.com/.