Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How can I create MS Word 2013 documents using Perl?

by Anonymous Monk
on Jul 30, 2014 at 11:41 UTC ( [id://1095600]=note: print w/replies, xml ) Need Help??


in reply to How can I create MS Word 2013 documents using Perl?

When in Windows land, do as the Romans do ... use OLE. Open a "Word.Document" object and tell it what to do. The installed version of Word actually does all the work.
  • Comment on Re: How can I create MS Word 2013 documents using Perl?

Replies are listed 'Best First'.
Re^2: How can I create MS Word 2013 documents using Perl?
by Anonymous Monk on Jul 30, 2014 at 14:11 UTC

    It has been a good (or bad) few years since I dealt with this sort of thing, but my experience then was that OLE into Word was on the fragile side. It would probably have been perfectly acceptable if there had been someone at the keyboard when the document was being generated, to deal with any random modal dialog Word decides to display. But in my case, the Word document was being generated overnight on an unattended server, and we found out about dialogs when users complained that they did not get their reports. We converted from OLE and Word to custom- (and probably badly- ) written Rich Text to deal with it. We actually called the files .rtf, and Word had no problem opening them.

    I reiterate, though, that this was a few years back. I have no information on whether Word is better at this sort of thing these days.

      Dialogs are still a serious problem with Word and other applications.   If you are able to generate, reliably and accurately, a “transportable” format that you know your version will accept, then that is definitely a good alternative.   It will probably be best to let the Microsoft application itself generate the document that can then be used as a programmatic basis for what comes next, e.g. by turning it into a Template or something like that.   But it can still turn out to be a crap-shoot.

      If you do use a Perl module to generate the base document, I definitely would shoot for one of these transportable formats, versus trying to emulate Microsoft’s file-madnesses ... and in any case I would be sure to use the most-current and most-recently-updated CPAN module that you can possibly lay your hands on, whatever one that turns out to be.   If it is “a few years old,” even, there could be problems.   Test the holy-hell out of whatever you do finally come up with, and then pray that Redmond will smile.

        When using OLE to more recent MS Office versions, it's usually most helpful to turn off all the warnings before operating and then turn them back on when done. I've found this to be useful for preventing popup dialogs. Got to remember to turn them back on though...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1095600]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-16 17:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found