I want to know how to export a List (like a datagrid) to excel.
I am not talking about a CSV, but a real xlsx file that is XML and compressed, etc.
I have only seen a few examples about Open XML from Microsoft.
Second thing and the most important, how do you save that excel not on disk at all, but instead write it back to the client on the web using response.write….
Bill.
I usually do it by rendering a DataGrid control that is bound to the list and I set the response content-type to “application/vnd.ms-excel”. The file then opens in Excel. Excel gives a warning about the file being of the wrong type, but it opens it nevertheless.
The code I use is something like this in Page.Render():
I know that this does not answer your question directly, but maybe it will help anyway.