Saturday, May 16, 2009

Different Document Types

You already know that Salesforce.com allows you to easily create web pages to display information from your objects, but did you know you can also create other types of documents quite easily?

Two formats are currently supported: Microsoft Excel and Acrobat Reader (PDF).

These properties for the <apex:page> tag will create an Excel document called “Cases.XLS” with the contents of your page:

<apex:page contentType="application/vnd.ms-excel#Cases.xls" cache="true">
The cache=”true” property is quite important, especially when the user browses your ORG with Microsoft Internet Explorer.

These properties will create an Acrobat Reader document called “Cases.pdf” with the contents of your page:

<apex:page contentType="application/x-download#Casessomedocument.pdf" renderas=”PDF” >
Note: Your page should not have <apex:input*> tags. First of all, it does not make sense to have these tags if the forms are not to be posted back to Salesforce.com. Second, the rendering of these tags may not be as expected. But, it is quite valid to use links.

No comments:

Post a Comment