Hi I am having a list container which contains the list of values. I wish to export the list values directly to Excel. Is there any way to do it directly?
feedback
|
OK, here is a step-by-step guide if you want to use COM.
| |||
feedback
|
You could output them to a .csv file and open the file in excel. Is that direct enough? | |||
feedback
|
The most straightforward way (in my opinion) would be to simply put together a CSV file. If you want to get into formatting and actually writing to a *.xlsx file, there are more complicated solutions (and APIs) to do that for you. | |||
feedback
|
Using the CSV idea, if it's just a list of Strings. Assuming
| ||||
feedback
|
Depending on the environment you're wanting to do this in, it is possible by using the Excel Interop. It's quite a mess dealing with COM however and ensuring you clear up resources else Excel instances stay hanging around on your machine. Checkout this MSDN Example if you want to learn more. Depending on your format you could produce CSV or SpreadsheetML yourself, thats not too hard. Other alternatives are to use 3rd party libraries to do it. Obviously they cost money though. | ||||
feedback
|
the one easy way to do it is to open Excel create sheet containing test data you want to export then say to excel save as xml open the xml see the xml format excel is expecting and generate it by head replacing the test data with export data @lan this is xml fo a simle execel file with one column value i genereted with office 2003 this format is for office 2003 and above
| |||||||||||
feedback
|
List<"classname"> getreport = cs.getcompletionreport(); var getreported = getreport .Select(c => new { demographic = c.rName); hopes this helpswhere cs.getcompletionreport() =reference class file is Business Layer for App | |||
feedback
|