Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

using Perl to generate docx file

by jedikaiti (Friar)
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
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2016-10-01 01:08 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (574 votes). Check out past polls.