function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kapil chauhan 6kapil chauhan 6 

Generate document in Excel or word format using Salesforce Data

We are trying to generate excel and Ms-word format document using the salesforce data , having tables , logos and other information in it .(Which will be generated on button click).

I used VF page (using renderAs = PDF) to generate PDF document and it works fine .

But when we use [contentType="application/msword#myDocument.doc" OR contentType=application/vnd.ms-excel#MySheet.xls] in VF page , though it generate Excel or word format , but formating is all mising and we dont have any control over it .

Any app exchange product will be last option but looking for any custom solution .
VinayVinay (Salesforce Developers) 
Hi Kapil,

Check below working example.

https://salesforcesource.blogspot.com/2009/04/how-to-create-word-pdf-or-excel-files.html

Please mark as Best Answer if above information was helpful.

Thanks,