in reply to Mail Merge with Word 2007 and Perl

I finally got the program to work. This is what I came up with

use strict; use warnings; use Win32::OLE ; use Win32::OLE::Const 'Microsoft Word'; my $sourcefile='C:\Users\Carl\Documents\AddressMergeTXT.txt'; my $mergefile='C:\Users\Carl\Documents\Merge.docx'; my $template = 'C:\Users\Carl\Documents\MergeLetter.docx'; my $Word= Win32::OLE->new('Word.Application', 'Quit'); $Word->Documents->Open($template); $Word->ActiveDocument->MailMerge->OpenDataSource($sourcefile); $Word->ActiveDocument->MailMerge->{Destination} = wdSendToNewDocument; $Word->ActiveDocument->MailMerge->Execute; $Word->ActiveDocument->SaveAs($mergefile); $Word->Documents->Close(wdDoNotSaveChanges); undef $Word;

Now, can someone show me how to convert the above merged docx file into an eps file using Postscript::Simple? I would like to do it all in the same program.

Thanks again for any suggestions

Carl

Replies are listed 'Best First'.
Re^2: Mail Merge with Word 2007 and Perl
by roboticus (Chancellor) on Aug 19, 2014 at 17:57 UTC

    cmiller2005:

    The file is still in word format, so I can't imagine a way to use Postscript::Simple to create an EPS file from the mailmerge. I'd suggest instead telling Word to print to a file using a postscript filter (I think that's included by default in later versions of windows). Then you could use the resulting PDF or extract the postscript and further manipulate it.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Hi roboticus,

      Is it possible to merge a text file with a .eps file using Postscript::Simple? If so, could you give me some pointers. I appreciate all of your previous responses.

      Carl

        cmiller2005:

        Let's take a step back for a moment. What is it you're trying to do? If you're trying to get to an EPS file, you likely don't even need Word and may be overcomplicating things. Give me an overview of what you're trying to do, and maybe I can offer some advice on how to get from 'here' to 'there'.

        I've never used Postscript::Simple before (or have forgotten it if I did), so I couldn't speak to merging text into an .eps file. But do you even need an .eps file, or is that just another step on the way to what you're trying to do?

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.