How do I export data from my C# console application to Excel using Microsoft.Office.Interop dll?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
You can get many Excel tutorials for c sharp available on internet
Refer to this link http://csharp.net-informations.com/excel/csharp-excel-tutorial.htm
Update
You go to this link for your solution with dataset
http://itsrashid.wordpress.com/2007/05/14/export-dataset-to-excel-in-c/
http://www.codeproject.com/KB/office/ExcelDataTable.aspx
Hope this may help you
Add a using statement like this:
Then define a variable that will enable you to work with Excel documents and workbooks:
Create a function that will write from your DataSet into an Excel document (This is from one of my Windows applications button_click function, but I think you will be able to make the necessary adjustments):
As you see, I use DataGridView to display the data that I want to write into the Excel file, but since DataGridView uses DataSets I dont think you will have to much problems to adjust this code