views:

46

answers:

1

i have a single powerpoint slide that we use for reporting. This slidehas some tables and some textboxes with bulletted lists

We are trying to see if we can update this powerpoint slide (update text in textbox and update text in tables) using C# as we now have a lot of the data that we manually add to this slide in a SQL database.

so i basically need to:

  1. load up current presentation and this single slide (treat it like a template)
  2. access textboxes and clear current text
  3. enter new text from my data source (happens to be SQL server)
  4. update tables
  5. save as specific filename

what is the best way of doing this from C#. i want to basically have a button in a webpage or a winforms app that kicks off the steps above.

A: 

If you are working with any PowerPoint file formats (including the default one used by PowerPoint 2003), you have to use Microsoft Office & PowerPoint Interops. There are probably some third party libraries, but I'm not sure they will be very helpful in this particular situation, except if you don't want to or can't install Microsoft Office on the server.

If you use only the new PowerPoint 2007 format or 2003/2007 XML format, then changing the XML directly may be the easiest way, thus this does not require Microsoft Office to be installed on the server.

MainMa
@MainMa - i am only targeting powerpoint 2007. not sure if that heps
ooo
MainMa - also, i want to avoid third party libraries and do you have any good examples or links ?
ooo
@ooo: again, if you deal only with Office Open XML format, than you may manipulate the XML data directly. For Office Interop, see http://stackoverflow.com/questions/1044996/how-to-replace-text-in-a-powerpoint-ppt-document/1083575#1083575 on SO. A sample code may also be helpful: http://www.discussweb.com/c-programming/4190-how-create-powerpoint-document-c.html#post14529
MainMa
MainMa - i want to be able to run this from a webserver so i am going to try the openXML. do you have any examples of working with this XML to do common things (add item to bulletted list, replace text on existing textbox, etc).
ooo
@ooo: http://blogs.msdn.com/b/erikaehrli/archive/2007/03/19/openxmlworkshop_5f00_newpowerpoint2007visualhowtos.aspx and http://msdn.microsoft.com/en-us/library/bb245053%28v=office.12%29.aspx may be a good start.
MainMa