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

Hi

What is the best approach to creating Word and Powerpoint files through perl? I have seen some libs on cpan, but none of them seem to utilize office 2007s open XML format. Is this not a good way of going at it?

I havent been able to find a clean hello world example either of such open xml based word documents.

I need to use word, and not open office.

  • Comment on Best libs to use for creating word and powerpoint files?

Replies are listed 'Best First'.
Re: Best libs to use for creating word and powerpoint files?
by locked_user sundialsvc4 (Abbot) on Feb 16, 2010 at 03:41 UTC

    If you are working in a true MS Windows environment, easily the best way to approach this is through OLE/ActiveX. In other words, instantiate a Word.Document instance and tell it what to do.

    There are plenty of CPAN modules that will carry you this far, and, I daresay, probably some that go the whole nine yards. Definitely worth a close look:   anytime you wander into what you instinctively know should be “familiar territory,” someone in CPAN-land has almost invariably indeed preceded you, and left a trail of jewels behind. And, for all we love to criticize and lampoon them, the Microsoft people did a bang-up job with OLE support for their products.

Re: Best libs to use for creating word and powerpoint files?
by ww (Archbishop) on Feb 16, 2010 at 01:25 UTC

    Some clarification may help get you some answers:

    • "creating Word and Powerpoint files through perl?"
      Do you mean converting data which already exists in some other fileformat to Word and PPT?
      ...or
      "creating" ex nihilo from the keyboard and your imagination?
    • "...some libs on cpan"
      You do mean you've been searching for "modules," right? If not, do so.
    • "...utilize office 2007s open XML format. Is this not a good way of going at it?"
      Maybe, but not necessarily required. Once you have the doc created in an older Word format, Word will cheerfully foul it up ^H^H^H^H^H^H^H convert it for you.
    • "...find a clean hello world example either of such open xml based word documents."
      1. Perhaps because trying to write "hello world" or any other script using Word is an exercise in futility and frustration.
      2. and because M$ implementations of open standards are rarely conformant to the standards
    • "...need to use word"
      Is this relevant in some why I don't understand? Are you trying to tell us you don't want to hear about Open Office solutions, for good reasons or bad?

    And it might be useful to specify your OS, etc. In fact, reading On asking for help may help you update your post in ways that help us to help you.