I want to export my data from grid view to the excel. Unfortunately i came to know that there is no excel software on ser开发者_开发百科ver side. Is there any way that i can still export data in excel format without having excel software on server side.
Thanks.
you can create a CSV format text file, which excel can understand.
This question also outlines some other options you might be able to use, with pros and cons of both.
This must be one of the most asked questions on Stackoverflow.
See Create Excel (.XLS and .XLSX) file from C# For lots of suggestions and a whole list of linked questions.
One trick you can use it to export the html table to the client with the extension of .xls
. When the user opens the document with Excel and resaves it will become a real excel document. The fun part is it will retain most of the formatting from the HTML view. This works with HTML/TABLES, I'm not sure about DIV/SPAN/CSS.
精彩评论