views:

141

answers:

3

I have a bunch of data in a database and I want to generate some tables in PowerPoint. I had started doing this manually but I thought there might be a way I can simply write some code to take my data from the database and output it onto a PowerPoint slide.

Any advice here?

+3  A: 

You can certainly automate powerpoint trough the use of its XPCOM api -- (although, everytime I looked for documentation on the XPCOM API for MS Office I haven't found it)

But, I'd suggest that instead of creating PowerPoint slides, you created Open Document presentations (ISO 26300 - .ODT files) - which are easy to undestand, parse and edit programatically -

.ODT files are the default presentation format for Open Office, Koffice, and other office software, and I think that Microsoft has come to support it by now - (although they have pushed ISO to approve their own proprietary specification of a similar format)

Anyway, editing the contents of a .odp file is trivial; the ODP file itself is a zipped archive, you unzip it, and edit the "contents.xml" file inside it -- creating new slides is a matter of copying the XML node corresponding to a slide and editing the desired text -- and pack everything inside a zip archive again.

jsbueno
A: 

Probably the easiest route to take would be to use Excel to extract the data and then embed the spreadsheet in PowerPoint.

APC
+1  A: 

PowerPoint has access to VBA right? (It does, I checked) So, you should be able to automate the generation that way. I've done this pretty extensively but in to an excel document. I've never tried it with power point.

The problem now becomes one of time investment? Learn how to do it with VBA or do it manually... If this could be a common thing, I'd suggest you learn how to do it via VBA. Generally speaking, I found that automating Excel with VBA was not too hard once you understood the basics. The time saved was definitely worth it in the long run.

Finally, I wish I could recommend a book to get you started, but alas, I've never considered trying this so I've never put anytime in researching this.

Frank V