• Home
  • About
  • Doom II
  • Flog
  • Inspiration

PowerPoint in C#

Posted in Computing. on Friday, February 15th, 2008 by Derek
Feb 15

Given the task to develop a small C# app to generate a pre-styled PowerPoint file based on a multitude of input fields, I though the task would be simple enough. I was proven wrong and now return to the comforts of PHP and Java. Then I cringe for this devolution.

My misadventures started when I decided I should start off by searching for the PowerPoint API to ensure all the interfaces I wished were accessible without paying for additional tools or resources. First tip, don’t fucking searching for a combination of C# or PowerPoint through Google or MSDN. You will not find a single useful result. Some would say the search results are only as good as the keywords chosen by the user, but the organization of Microsoft’s knowledge base is so terribly convoluted that it renders the search function useless. How does Microsoft expect to compete with Google using its Live Search when it doesn’t even work well with their own fucking content? MSDN is a clusterfuck of broken links and spiritual dead-ends. Never try to browse their article tree structure. Never try to use the search. Never try.

I was able to gather that I needed to add the Microsoft PowerPoint 11.0 Object Library Primary Interop Assemblies (PIA) reference to my project in Visual Studio, but for the life of me, I couldn’t find a class/method reference for PowerPoint 2003 Interop. A workaround is to perform some Visual Studio trial and error by creating objects of the class Microsoft.Office.Interop.PowerPoint.Presentation and then using the dot operator to allow Visual Studio to give you hints of what methods and properties are available for use. A workmate of mine actually used this whole process to develop an app to extract screen captures and searchable text from each slide and then inserting them into a database, when requested via a web service.

Since I didn’t want to waste all my time developing like that, I decided to perform a more thorough search for the PowerPoint documentation. Lo and behold, I found my beloved under Microsoft Office PowerPoint 2003 VBA Language Reference. Yes, when I think of developing in C#, I immediately think to search for Visual Basic for Applications. MSDN couldn’t even have a single search titled Microsoft Office PowerPoint 2003 C# Language Reference that links to the VB version? You can browse to the language reference using the MSDN path:

MSDN Library » Office Development » Microsoft Office 2003 » Office 2003 » VBA Language Reference » Microsoft PowerPoint Visual Basic Reference

So I download the PowerPoint documentation file to find a ghetto WinZip extractor that installs to “C:\Program Files\Microsoft Office\Office11\1033″. I had to manually open this directory to get access to the Window’s help file it to find its full of JScript errors. However, we have the neutered web reference also available. My favourite part of this resource is visiting the What’s New? subsections to find them mostly empty with the message, “Visit the Office Developer Center on the Microsoft Developer Network Web site for the latest information about programming with Office PowerPoint 2003, including product news, technical articles, downloads, and samples.” Wait, isn’t that the site I’m currently fucking on? I tried to search MSDN for technical articles to find the differences between PowerPoint 2000 and 2003 to get a HTTP 500 error after 5 minutes of waiting.

Have I mentioned that PowerPoint code written for Office 2000 does not work with the 2003 libraries? It seems the Office team decided they didn’t like their original implementation, changing the core interface to make the COM/Interop connections to the PowerPoint Object Library references inconsistent. So say some the your clients have files created in Office 2000 that they want to upload a PowerPoint file to get a the screenshots taken to make them searchable on the web. Then another client has Office 2003 because they’re all fancy schmancy. You need two separate applications written.

In conclusion, help, get me out of here.

  • Now Playing: Built to Spill - Perfect From Now on - 06 - Out of Site

1 Comment

  1. Moshe Flam on January 29th, 2009

    Thanks for telling me I’m not the only one!



Leave a Reply

CAPTCHA Image
Refresh Image
*

Derek MacDonald


  • Photo Stream
  • Categories
    • Australia
    • Computing
    • Film & TV
    • Food
    • Gaming
    • General
    • Music
    • Sports
    • Visual Art
  • Search






  • Home
  • About
  • Doom II
  • Flog
  • Inspiration

© Copyright Derek MacDonald. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine

Back to Top