http://qs1969.pair.com?node_id=719593


in reply to Automating Word with Perl

This is what Win32::Word::Writer is for, automating away the drudgery of those common operations described in the other post about Win32::OLE.

As for the images, I guess you'll need to create images in a format Word understands and then use the appropriate Word API methods to include them.

If you start off with text, it may be clearer how to do that, or how to figure out how to do it.

/J

Replies are listed 'Best First'.
Re^2: Automating Word with Perl
by merrymonk (Hermit) on Oct 28, 2008 at 16:08 UTC
    This looked more than interesting so I have used your link to see the doumentation on CPAN.
    However I could not see any 'functions' to
    let me find a string and change found string.
    I also 'googled' the internet with no more success.
    Could you point me to a suitable 'address'?
      From your original question, I'm not sure why you would want to do that.

      Why not start with a template Word file (with nice headers, footers, logos etc), and then write the data from the Tk app into the Word document?

      /J

        OK I think I can see what you are getting at and I can see that it would work well becase it is standard documenets
        that I am trying to create.
        The problem I am still having is to understand how to move to the position where I want to add the text.
        I looked at the description again for some sort of 'positioning' facilitiy.
        I found MoveToEnd which takes me to the end of the document.
        I also saw some references to the cursor position but not how to 'set it'.
        There is the the comment "The documents are constructed in a linear fashion, i.e. you add text to the
        document and generally don't move around the document a lot".
        This made me wonder if I am trying to do something that this application was not designed for.
        Some more guidance will be more than apprecaited.
        My copy of Perl is supplied my a 3rd person.
        Sadly it does not include word-write.
        I have downloaded the tar file and unzipped the contents.
        I did try simply storing the .pm files in ...win32/word but this failed (perhaps not surprisingly!).
        I have never been involved in adding anything like this to Perl.
        Can you summerise what I should do or point me at some instructions?
        I guess one question is can this be added or does it have to be part of a complete build of Perl?