EchoAngel has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, is there anyway for me to interface to create a microsoft word document (with some tables and different fonts) because I have to parse many files to get the data. So I'm thinking is there a way to do this all with an execution of a script. Note: that I'm on linux/unix.

Replies are listed 'Best First'.
Re: Word Document and Perl
by gaal (Parson) on Jul 16, 2004 at 04:43 UTC
    FWIW, Microsoft Word reads HTML (including tables and fonts).

    A hack I've used to make it look completely transparent is to save a document with no text but with all the potential styles as HTML from Word, then use it as a template for stuff to edit (/generate from script). This way you don't even suffer from import artefacts: if you mimic the HTML Word uses, your documents will look exactly like they would if you'd created them there.
Re: Word Document and Perl
by dfaure (Chaplain) on Jul 16, 2004 at 07:39 UTC

    The "legacy" way to create a Word document would be using Win32::OLE in order to drive word to produce your document. This would work only on Win32. Choosing this solution, I would make a template document containing tags which I would "search&replace" with my datas.

    An other solution (linux friendly) would be to use RTF::Document which allows some bells and whistles without Word (same proposed solution applies also here).

    ____
    HTH, Dominique
    My two favorites:
    If the only tool you have is a hammer, you will see every problem as a nail. --Abraham Maslow
    Bien faire, et le faire savoir...