Showing posts with label sheet. Show all posts
Showing posts with label sheet. Show all posts
Monday, February 6, 2017
Generate Multi Sheet Excel File In Salesforce
Generate Multi Sheet Excel File In Salesforce
Hi All,
Recently I came across with a requirement where I need to generate excel file from SFDC data of some objects. Traditionally we do this by making csv file. But here the challenge was that i need to fetch data from multiple objects and make single Excel File with different Sheet (tabs), each sheet belongs to single object and contains that object data. So here is code, how i achieve it.
Here is the link you can download the code from :SFMultiSheetExcelGenerator
http://www.aslambari.com/downloads/SFMultiSheetExcelGenerator.zip
The folder contains some VF pages and some classes. There is one demo VF page also which contains a button which generates the sample excel file with contacts and accounts data. You can see the working demo here:
https://labsprojects-developer-edition.ap1.force.com/MultiSheetExcelGenerateDemoThere is a component which is responsible to generate the excel data. You can see the sample code in "MultiSheetExcelGenerate.page" VF page. Here is the code , how you use this component:
<apex:page controller="MultiSheetExcelGenerate" sidebar="false" showHeader="false" contentType="application/vnd.ms-excel#myfile.xls">
<c:multisheetexcelcomponent datamodel="{!dm}" />
</apex:page>
Have a look and use the code as per your need and mail me with your valuable feed backs as always :)
Thanks
Aslam Bari
Available link for download
Subscribe to:
Posts (Atom)