Fast Exporting from DataSet to Excel

Exporting data from a .NET application to Excel is a very common requirement. A simple search on the Web results in several examples that show us the method to copy data and put it into the Excel cells. However, there is a payload with this method: each interaction to put a value into an Excel cell requires an InterOp invocation. If the amount of data to transfer is huge, we have a problem with the performance of the method. Is there a better way to accomplish this?

Read more...

 

1 Comment

  • If you need to generate an Excel spreadsheet in a web application an easier way is to set the content type to "application/vnd.ms-excel" and then create a regualar HTML table (even a DataGrid or GridView might work). The only disadvantage is that the Excel spreadsheet will not be in the native binary format. A client might be confused if he edits the spreadsheet and finds a folder created as happens with the HTML format of Excel.

Comments have been disabled for this content.