Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I've been poking around the previous questions posted about Word documents and OLE, but couldn't find anything that addressed my problem.

What Word objects/methods should I be using to find/replace text in an existing word doc? I know how to insert text at the end of a document, but I would like to insert text at a specific point, as marked by some sort of text marker.

question 2, if that one was too easy: How would I change the source image of an embedded picture?

Replies are listed 'Best First'.
Re: replacing text in MSWord? (win32::OLE)
by t0mas (Priest) on Aug 21, 2002 at 15:17 UTC
Re: replacing text in MSWord? (win32::OLE)
by richardX (Pilgrim) on Aug 22, 2002 at 20:34 UTC
    I have done alot of R&D in this area and it is true, it is very slow to use OLE. Here are the alternatives that I have tried with varying amounts of success:

    Used a text template system and then imported the raw ASCII into the Word document
    Wrote VBScript to automate the search and replace of global variables that I created i.e. {{first_name}}. This option allowed me to retain more Word formatting
    Used text templates with raw RTF output that Word could import

    Richard

    There are three types of people in this world, those that can count and those that cannot. Anon