Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
How can I make the export more faster.

this one is too slow..
Posted
Updated 16-May-13 21:16pm
v2

If you fetching data from database, the fastest way to export data is to use CopyFromRange()[^] method for MS Excel range.

More about: How to transfer data to an Excel workbook by using Visual C# 2005 or Visual C# .NET[^]
 
Share this answer
 
To improve performance you need to minimise the use of the Excel COM interface.
I would suggest converting your list of objects to a datatable first and then exporting that to excel ...

Here is a generic way to convert a list<t> to a datatable Converting a List to Datatable[^]

and here's how to export it to Excel using XML[^]
 
Share this answer
 
Comments
Maciej Los 14-May-13 17:28pm    
Nice, +5!
Please, see my answer ;)

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