Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How export data to excel in WCF Service. Want to generate excel file more than 10,000 in single call. This operation should be fast.

What I have tried:

Hi,
I created one way WCF service. In which I processed all data at service side.
Also I was exporting data to excel using local report (rdlc used for formatting and exporting) but for no. of times (i.e more than 10000) I'm exporting data to excel, which takes a lot of time to generate using rdlc and also rdlc have memory leak problem.

So is there any solution ? Please help.

Thanks.
Posted
Updated 27-Oct-18 4:44am
Comments
F-ES Sitecore 27-Oct-18 7:09am    
If you google how to create Excel files via c# you'll find loads of articles and libraries, so try them all. Maybe start with using the Excel ODBC driver which lets you read\write to Excel sheets like they were tables in a database.

1 solution

This is the first way I would do it:

0) Send a request to the server to generate the file.

1) As mention by F-ES Sitecore[^], have the server generate the Excel file using the Excel ODBC driver, and save the file using a GUID for the name, such as EE430293-3460-4251-AD14-84E4E99B6E8E.xlsx (un-guessable and always unique).

2) Contact the client when the file is ready (providing the filename in the message)

3) The client can then transfer the file using some secure means, such as SFTP.

4) After a certain amount of time (24 hours?), the server can automatically delete the file in the interest of self-maintenance.

This way, your the server does all the work creating the file, and simply allows the client to know the filename, at which point, an actual transfer can be requested (by the client).

Another option instead of using an actual Excel file is to have the database return the result set as XML, with is an Excel-compatible format as well. That way, there's no need for ODBC at all (and it might even be faster).
 
Share this answer
 
v3
Comments
sudhir.mali 27-Oct-18 22:51pm    
Hi tried with actual excel,
So for 50 excel generation it takes 1min (current one excel not contain more than 25 rows).
need to improve performance.
Also in excel I need to handle subtotal and grand total part ,freezing rows and other formatting part too.
sudhir.mali 27-Oct-18 22:51pm    
Now trying with openxml dll,
Hope so it will try to improve performance.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900