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
AshesAshes 

Unable to do export to excel if list contains for than 1000 records.

Hello Everyone,

 

I am using export to excel functionality in my application. It is working fine if list contains less than 1000 records and not working if list is having more than 1000. 

 

When I have done R&D, I found that we can store more than 1000 records in List but if we are going to use it in VF page or DataTable of VF page it gives me exception that 'Collection size 1,007 exceeds maximum size of 1,000'.

 

We can use pagination in this functionality, but it is Separating excel sheet for each page, Which is not a client requirement. Client wants all records in a single excel sheet.

 

So Please suggest me a solution.

 

Regards,

Ashes

Navatar_DbSupNavatar_DbSup

Hi,

 

In vf page we can display upto 1000 records in <apex:pageBlockTable>,<apex:dataTable>and <apex:repeat>.

For more detail follow the below links:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_dataTable.htm

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_readonly_context.htm

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

AshesAshes

Thnks Navatar_DbSup for your help.

 

Its working. But now I have I am facing new error. If I have tried to export more than 2000 records through export to excel functionality I am getting below error 'Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 165.953KB'. Please guide me.

 

Thnks and regards,

Ashes

SathyaincampusSathyaincampus

Did you get an answer for this? 

I need to export about 30000 records. Despite giving transient for a fiew fields and readonly attribute in the page, I am getting the Viewstate (135KB) exceeded errors. I see in Ankit's blog (http://forceguru.blogspot.in/2010/11/best-practise-to-write-apex.html)

that I have to set the lists that i am using to null or clear out the data in the list. I am binding the list from the controller to the VF page. How can i clear that? Is there any solution for this?

jd_06jd_06
Sathyaincampus, were you able to find a solution? I too am having this issue. If you found a resolution, will you please post? Thank you.
SathyaincampusSathyaincampus
I have just added readonly=true in apex:page as of now :( which just allows you to show upto 10000 so far... Even I need to export about 30000 records Mis-typed words brought to you by iPhone :)