cfpresentation and HTML slides

This post is more than 2 years old.

This topic came up from a cf-newbie discussion this weekend, but did you know that cfpresentation can be used to create HTML presentations? The reference is a bit confusing on the matter. If you look at the docs for the format attribute, it says this:

Specifies the file format for conversion:
  • ppt
    converts html input provided in cfpresentationslide to a PowerPoint file.
  • html
    converts ppt to an HTML presentation.

The implication being that you can use the tag just to convert a Powerpoint file into HTML. You can do that. But you can also create ad-hoc presentations and feed them right into html. So an example:

<cfset dest = expandPath("./mypreso")> <cfif not directoryExists(dest)> <cfset directoryCreate(dest)> </cfif>

<cfpresentation title="Ray's Presentation" format="html" destination="#dest#" overwrite="true"> <cfpresentationslide title="Slide One"> This is my first slide. Epic. </cfpresentationslide> <cfpresentationslide title="Slide Two"> This is my second slide. Epic. </cfpresentationslide> <cfpresentationslide title="Slide Three"> This is my third slide. Epic. </cfpresentationslide> </cfpresentation> Done.

In this code template, I'm saving the presentation to a directory. You don't have to do that. If you leave off the destination it will render in the browser. I've added "Done" to the end of the script just so I know, well, when the CFM is done. I've got three simple slides. Once done, the output is saved to a folder:

The result is a HTML/JavaScript slide viewer. I'll be honest. It isn't... stellar. You can view this yourself here: http://www.coldfusionjedi.com/demos/aug82011/mypreso2/

Sexy, right? Ok, maybe not. But for a quick and dirty result, it's better than nothing. Be careful with it. I tried embedding a PNG chart and while it worked locally, it wasn't available when pushed to production.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by John Farrar posted on 8/8/2011 at 7:55 PM

I have not tested this but does ColdFusion have a way of buffering these presentations?

Comment 2 by Raymond Camden posted on 8/8/2011 at 7:58 PM

Why would it buffer an HTML presentation that doesn't auto forward?

Comment 3 by John Farrar posted on 8/8/2011 at 8:09 PM

Should have said cached, not buffered. The reason is to reduce overhead of processing same data in Flash format if nothing changes from one user to the next. If the data is personalized then caching would not make sense of course.

Comment 4 by Raymond Camden posted on 8/8/2011 at 8:16 PM

Ah, well the destination attribute ALSO works for the vanilla Flex output. So you could generate it once and be done with it. That's what I would do.

Comment 5 by Jewel Pajarillo posted on 5/22/2014 at 1:18 AM

Hi,

I just wanna ask if you can use a powerpoint as a source for the cfpresentationslide tag? I want to convert a powerpoint to html. I've been trying to use ppt as a source but it will give me this error: Could not initialize class com.sun.star.lib.loader.WinRegKey

Thanks

Comment 6 by Raymond Camden posted on 5/22/2014 at 1:24 AM

I believe you need to have OpenOffice installed on the server for that to work. Do you? And is it configured in the admin?

Comment 7 by Shane Hahn posted on 10/7/2014 at 9:39 PM

Hi Raymond,
I too am trying to use a ppt file as the source to create an html presentation, but am stuck with the same error as Jewel Pajarillo. (Could not initialize class com.sun.star.lib.loader.WinRegKey)

The CF9 docs say OO is only required for using doc files as the source? Any idea what else the issue could be? Unfortunately the error doesn't give any other details.

Thanks,
Shane

Comment 8 by Raymond Camden posted on 10/8/2014 at 2:22 PM

Um - no idea. Did you try adding OO even though it may says you don't need to?