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
vickySFDCvickySFDC 

How to generate excel file only for selected contact records?Urgent help needed....

Hi All,

 

 

I want generate excel file in Contact list while clicking Generate excel btn?this is only for selected contact records ?Can anyone help regaring in this scenario.I have done for all records as Excel file but I am not able to generate only selected record.

VF Page:

 

<apex:page standardController="Contact"  contentType="application/" recordSetVar="Contacts" extensions="contactexcelgen" showHeader="false" >  

<apex:form >

 <apex:pageBlock >

  <apex:pageblocktable value="{!record}"  var="r" >   <apex:column value="{!r.name}"/>   

</apex:pageblocktable>

  </apex:pageBlock>

</apex:form>

</apex:page>

 

THANKS,

Vicky

gbu.varungbu.varun

Hi Vicky,

 

Just put contentType="application/vnd.ms-excel#myfile.xls"  to generate Excel file.

vickySFDCvickySFDC

Hi ,

 

I got solution

 

 

Thanks,

 

Vicky

gbu.varungbu.varun

It is littile bit tricky. You can do it in such a way.

  1. Show check-box for each record. 
  2. Get ID of selected recordsd
  3. Pass all id in URL (Add All ids in String by &)
  4. On the next VF use contentType="application/vnd.ms-excel#myfile.xls" and get all ids in string. 
  5. Spilt String where & is get and add it in a set.
  6. Get all contacts and display on the VF.
  7. It will generate en excelSheet
vickySFDCvickySFDC

Hi,

 

Thanks for reply..

 

Pls can u post the Apex code urgent help....

 

 

Thanks,

Vicky

 

 

 

 

Jeremy GoreJeremy Gore
Hi, above all you can still try how to generate excel files on C# via ZetExcel.com