A PowerPoint Image Sequence Generator
I needed a way to generate a PowerPoint presentation that did not require PowerPoint or a PowerPoint Viewer, that is, it would just be a sequence of images with navigation capabilities. The purpose of this program is very narrow, and serves one key purpose: I can take a "Gray Cat Story", a sequence of PowerPoint slides, and create a Web-readable version of it that anyone can read, whether they have PowerPoint installed or not.
This is presented here mostly as an example of some programming techniques. It was designed and coded in under three hours over a ten-hour period, which included a four-hour nap, dinner, and a shared movie.
This is a highly-specialized program but is nonetheless not a quick-and-dirty hack. It provides the title for each slide, the directory into which to generate the slides, a tag for the visit-count, a specification of how many pages to generate, and a specification of how many rows of buttons to create for page selection.
An example of what was created by this particular set of parameters can be found here.
I did not do anything sophisticated such as use Cascading Style Sheets (CSS), and the program is so trivial that I didn't bother to create a thread to do background processing. All I did was disable all the controls during the processing. Because I was using a single thread, I had to call UpdateWindow to force the progress bar to redraw.
I use FormatMessage to format the file. To allow the user to modify the template, I will look in the executable directory for a specific file (called "Page1.htm"), and if I'm running in debug mode, I'll also look for "..\res\Page1.htm" which is the name of the file included as a resource. If neither is found, I default to using the resource. This expedited my debugging. The resource is stored as an 8-bit character file. So all of the variables that deal with the output are all CStringA variables.
Mostly, my rationale for publishing this was that I wanted to show this off to show what I think is a "quick and dirty" personal program, and how I apply the design principles I espouse so that a quick-and-dirty personal program is still not a quick-and-dirty hack.
To generate the PowerPoint slides, I use the File > Save As... and generate a sequence of PNG graphics files. These have the least offensive rendering, although it is not great.
When the Save button is clicked, a dialog will come up
Select the option of "Every Slide". A sequence of files will be written in the selected directory, with names (unfortunately) Slide1.PNG, Slide2.PNG, ..., Slide84.PNG. The major design failure here is that the extensions are in uppercase and the first letter is also in uppercase. Because Web page names are case-sensitive, this is a very unfortunate misfeature of PowerPoint. I considered adding a feature to the program to rename the slides, but given that it is a single command issued to the shell.
ren Slide*.PNG slide*.png
I decided to ignore the problem.
But now I can add more Gray Cat stories to my Web site without major effort.
The views expressed in these essays are those of the author, and in no way represent, nor are they endorsed by, Microsoft.