Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

using Perl to generate docx file

by jedikaiti (Hermit)
on Mar 04, 2010 at 19:37 UTC ( #826792=perlquestion: print w/replies, xml ) Need Help??
jedikaiti has asked for the wisdom of the Perl Monks concerning the following question:

So here's my assignment: I have an existing Perl script that takes a bunch of info dumped from a database and uses LaTeX to turn it into a PDF file. My job is to change this so the info is turned into a Word .docx file (which, for anyone who doesn't know, is a zip archive of a bunch of XML files).

My question is, does anyone know of any readily-available scripts that already do this (or something similar, in part or in whole), so I don't reinvent any wheels unnecessarily? Or, if not, do any of the more experienced folks here (I'm also learning Perl while I work on this) have any suggestions on how to approach this problem? Any constructive feedback you can provide would be helpful!


Replies are listed 'Best First'.
Re: using Perl to generate docx file
by Corion (Pope) on Mar 04, 2010 at 19:40 UTC

    It seems there are no DocX modules on CPAN, but if it's "just XML", I would suggest you go the route of creating a template in Word and then use one of the template modules to replace the placeholders in your template with the actual data from the database.

      Thanks! I do have a Word template for the document, so I'll go look at the template modules. :-)



        Hi Kaiti, I have quite the same thing to do : from a set of data, generate a .docx (or .doc) document as automatically as possible. Did you manage to do that with the Word templates? Cheers, Xavier.
Re: using Perl to generate docx file
by MidLifeXis (Monsignor) on Jul 19, 2011 at 15:23 UTC

    The org-mode project ( has an org-odt export module that may provide a similar template.


      Thanks a lot, I'm now trying to find it on their website!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://826792]
Approved by toolic
[1nickt]: thx chacham. Not sure if it would be more work defining the new acronym or explaining the grey areas of the existing one :-/

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2017-07-22 19:00 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (340 votes). Check out past polls.