0

We have an upcoming project that requires converting Salesforce data into PowerPoint. I've heard great things about Conga, but we're doing some additional testing/research to make sure that if Conga doesn't work out for us we have some other options.

I tried creating a VisualForce page with contentType="application/vnd.ms-powerpoint" and the following contents:

<apex:page contentType="application/vnd.ms-powerpoint.presentation/PowerPointTesting.ppt">
    <h1>Page 1</h1>

    <div style="page-break-before: always;"></div>

    <h1>Page 2</h1>
</apex:page>

This page renders in my browser no problem, and automatically prompts me to download the PowerPoint. This PowerPoint saves and opens no problem, but the HTML is not rendered properly. The whole thing, tags and all, is just sitting there in a text box.

Does anyone have any insight into why this is happening?

1

Changing the contentType attribute on a Visualforce only tells the browser (or lies to the browser about) what kind of content is being returned. It doesn't do anything to alter how the page's content is generated. When you download your page, you're really just opening an HTML document in PowerPoint.

The only option Salesforce provides to generate anything other than HTML is renderAs="pdf". If you want to generate a file format other than HTML or PDF, you have to be responsible for generating correct, well-formed content in the target file format.

Since current versions of Microsoft Office do use an XML-based (zipped) file format, it's at least plausible that you could use Visualforce to generate the XML portion of a well-formed PowerPoint document. You'll need to get very familiar, however, with the details of the Office XML format specifications. It's been done for Excel sheets, although I've never seen a PowerPoint example in Visualforce.

  • Thanks for the answer. I saw in the VisualForce documentation how easy it was to convert to Excel, and hoped PowerPoint would be similar. I'll go ahead and read through the link you provided and see how feasible that would be for our project. Thanks again for the response! – Ryan Dinesman Mar 7 '19 at 16:47
  • @RyanDinesman The Excel side is a bit of a hack. Excel will open files that contain HTML tables and render them (mostly) like a spreadsheet. The UX is not actually all that good, though, because Excel still knows it's not a real spreadsheet file. – David Reed Mar 7 '19 at 16:50
  • Pretty cool that it can do it though. It's crazy the things that Excel can do. – Ryan Dinesman Mar 7 '19 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.