i have a destop application and i have data in 4 arrays, what i want to do is to open an excel file and then add the array data into the excel file, nd then save the excel file .
please how can i do it

i tryied using the using CarlosAg.ExcelXmlWriter;
but is says cannot find.

how can i do this.

7 Years
Discussion Span
Last Post by arjunpk

I don't know CarlosAg.ExcelXmlWriter.
I know office interop:
When you have Excel installed on the machine that runs your application you can use the standard Office Interop classes, which are very widely documented. In code you should open an instance of ExcelAppliction. With the Workbooks-collection of the ExcelApplication you open or creates an Excel workbook. Next from that workbook you grab one of the Worksheets, which you are (you're code) going to provide with data.

A little dirty trick is to create on colon-separate-file and provide that with the .xls of .xlsx extention. If you open this file, Excel asks whether it is safe to open the file.


it's quite simple actually....


the above link will give you how to export a datatable to excel.....
you can either follow the same procedure by first inserting your array into a data table and then exporting it to excel.....


based on the code in the above link.. you derive a logic to export arrays to excel.... i used to find it very tough initially... but right now exporting data and formatting it in excel programmatically through c# seems quite simple.....

try doing it ... if you get stuck somewhere... post your code here and we'll help you out....

take care....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.