About_us

Blog : Our Thoughts..

Generate Word, PDF,Excel Files with Salesforce Data

Salesforce to PDF Word

One of the most frequently requested requirements by clients is that they should be able to export/display data into different document templates for various purposes.
Customer would be using such templates to create custom documents such as Fax sheets, Quotes, Invoices, and Forms that were required to be filled out by the end user in traditional ways.

A combination of Apex and Visualforce page allow us to generate such documents combined with Salesforce data. The documents can be formatted in number of types such as PDF, Excel and Word.

Let`s see how we can display Salesforce data using Visual force pages.

Generation of pdf file:

Salesforce data can be displayed in Visualforce page using Controllers as per the client template format

Visualforce can be easily converted to PDF documents automatically—simply add “renderAs” attribute of <apex:page> tag

Example:
<apex:page  renderAs=”pdf”>
……
Code to display data in the desired format
……
</apex:page>

Generation of word file:

To generate Ms-word file, we just use contentType=”application/vnd.msword” attribute of <apex:page> tag.

Example:
<apex:page  contentType=”application/vnd.msword”>
……
Code to display data in the desired format
……

</apex:page>

Generation of excel file:

Now if we need to generate Excel file, we just use contentType=”application/vnd.ms-excel” attribute of <apex:page> tag .

Example:

<apex:page  contentType=”application/vnd.ms-excel”>
……
Code to display data in the desired format
……

</apex:page> server headers site information expiration of domains .

Leave a Reply

Touch base with us to collaborate

© 2018 | Tvarana Software Solutions

Facebook Icon Tvarana Twitter Icon Tvarana LinkedIn Icon