Activity › Forums › Salesforce® Discussions › Generate MS-Word document (.docx) using Salesforce Visualforce pages
Tagged: Apex Page, Content Type, MS-Word Document, Salesforce Development, Salesforce Documentation, Salesforce Visualforce, Salesforce Visualforce Page, StandardController
-
Generate MS-Word document (.docx) using Salesforce Visualforce pages
Posted by Arshadulla on December 5, 2016 at 8:38 AMHow to Generate MS-Word document (.docx) using VF pages?
Any workaround for (dot)docx files.Avnish Yadav replied 7 years, 7 months ago 3 Members · 2 Replies -
2 Replies
-
Hi Arshadulla,
In your Visualforce page,you have to add contentType to get any type of files.
<apex:page standardController=”Account” showHeader=”false” contentType=”application/vnd.msword” >
……………..
code here
……………
</apex:page>
Thanks
- [adinserter block='9']
-
Hello,
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 .
Thanks.
Log In to reply.