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

Does anyone know of a module that will generate PowerPoint files?

I've found TK:Slideshow and XML::Handler::AxPoint on CPAN, but they produce "PowerPoint-like slideshows". I need to produce an actual .ppt file, or at least something that can be opened by PowerPoint. (I know, I know, but the client insists)

In particular, I want to exploit PowerPoint's "create a slide" function to input a series of data and have PowerPoint generate bar charts from it - something you can do within PowerPoint manually. How to do it on the server in Perl and then serve the resulting file to the user?

Thanks guys.

Replies are listed 'Best First'.
Re: a module to generate PowerPoint?
by traveler (Parson) on Jan 27, 2004 at 16:11 UTC
    There are some really good hints in this node. The key (as pointed out in that node) is to understand the DOM if you want to make an Office tool do stuff. The earlier comment about recording a macro and translating it to perl is also a good idea.

    HTH, --traveler

    Update: Fixed node id

Re: a module to generate PowerPoint?
by stvn (Monsignor) on Jan 27, 2004 at 15:54 UTC

    I suspsect Win32::OLE would be able to help you, although I doubt it would be a simple task. Of course this is assuming that PowerPoint and OLE play well together.

    -stvn

      In fact, automating Office applications is simple through the Macro Recorder functionality in them. You simply record a macro, do what you want to do, and then translate the generated Visual Basic code to Perl (which means mostly replacing . by ->).

      Another solution would have been ooolib, but it dosen't support PowerPoint presentations yet. Automating OpenOffice.org (the program suite) is an ugly task as they expose an ugly underdocumented Java API as OLE objects instead of copying Microsoft and their Office object model. And the Macro Recorder for OpenOffice.org dosen't produce usable stuff, as it records to StarBasic instead.

      perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
Re: a module to generate PowerPoint?
by punchcard_don (Beadle) on Jan 27, 2004 at 16:21 UTC
    Ok, excellent. I've searched on "Win32::OLE and powerpoint" and found abit of info. This appears to be really poorly documented in the Perl community. This looks like one way to go, thanks.

    As for the Macro Reader - sounds great. But can I try more detail on you to see if it really applies?

    Here's what I need to do - this is all done over the web :

    1. receive the user's query for data
    2. retrieve some data from a database
    3. insert that data into a PowerPoint file
    4. download the file to the user so that PowerPoint opens automatically and displays a series of slides with barcharts representing the inserted data
    Do-able?
      This appears to be really poorly documented in the Perl community.
      How do you figure? You mean the Perl community hasn't documented a commerical microsoft product? That's crazy.

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.

      I am curious why this needs to be done in powerpoint? Seems like a rather... overly complicated solution for displaying graphs of data stored in a database.
Re: a module to generate PowerPoint?
by BrowserUk (Patriarch) on Jan 27, 2004 at 16:52 UTC
Re: a module to generate PowerPoint?
by Fletch (Bishop) on Jan 27, 2004 at 17:13 UTC

    If you don't mind an intermediate step you could generate OpenOffice-readable XML, and then use the OO automation to have it save that as PPT. I've done something similar with the OO spreadsheet app allowing populating TT-ish placeholders from a CSV file.

    See xml.openoffice.org for the specifications.

    Update: Fwee, writeup #500.

Re: a module to generate PowerPoint?
by punchcard_don (Beadle) on Jan 27, 2004 at 20:46 UTC
    Thanks everyone.

    I'm especially encourged by what I've not read. Noone's said "Trivial! Everyone knows you do it like this....here's a hundred online working examples..."

    Why PowerPoint? 'Cause the client wants to be able to, on the fly, capture a snapshot of the data over the web at this exact second, and immediately, with no manual intervention of their own, show a slick PowerPoint presentation of the data with all those bells and whistles like slide-fade-in. They don't want just a series of images. They don't want to have to fiddle with Excel as an intermediate step. They want: click a button, get a PowerPoint presentation ready to go.

    So anyway - it sounds like:

    1. It's at least possible, but not obvious
    2. I can quote this as a real development project, not "Just Another Powerpoint Generator".
    I appreciate the indications, and I hate to sound thick, but most of the suggestions give me the impression of soething that could work when running on the same machine as the Powerpoint or Excel app. Will it work remotely over the web?

    Thanks again.

      Perhaps the simplest way would be to have PP on the server, create and save to a local .ppt and then redirect the page that instigated the creation to download that.

      I wouldn't expect it to be quick though.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      Timing (and a little luck) are everything!

Re: a module to generate PowerPoint?
by CountZero (Bishop) on Jan 27, 2004 at 19:48 UTC
    My obvious MS Office solution (if one must use MS Office) for making graphs would be Excel. I consider the graphing possibilities of PowerPoint far below these of Excel.

    Making a graph in Excel would be as easy as downloading the data to a worksheet and running the graph-wizard. If the data is fairly standard, one could "pre-load" the spreadsheet with the graphs one need and drop in the data later, to have the graphs made automatically.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law