views:

138

answers:

3

Hi, I need to export huge amount of data from ado.net datatable(which i get by db query) to excel.

I tried the following way : 1. Create excel object with workbook/worksheet @ server side...and use memory stream to write whole document to client side.

But this gave me "out of Memory exception". bcoz my memory stream was was so huge.

So I replaced this with a new way - as follows :

Writing each row from datatable as a coma seperated string to client side. So, as and when we get each row ...we can write to client side ..no memory is used.

But by this way we can write to csv file...not to excel...

Does anybody know how to handle this situation.

Can I use silverlight to get data row by row from server, pass it to client side...build excel at client side.?

+2  A: 

try spreadsheetgear

OR

smartxls

Muhammad Akhtar
Is there no way to do the same without third party tool.?
anish mohan
i tried to create an xml file out of datatable and import it to excel...but i guess it need an xslt. Please tell me if you more about this
anish mohan
A: 

I'd keep the csv approach but write to a file and not the memory strea. After you've created the file, I'd use TransmitFile to get it to the browser. You can see more about using TransmitFile here.

Jeff Siver
to Transmit a file...I should have the file saved in webserver. That is not possible
anish mohan
You can save the file on any server; it doesn't have to be on the web server. The TransmitFile command will handle a UNC path as well as a local file.
Jeff Siver
A: 

Heloo...is anybody there :(...

anish mohan