hi,
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.

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.

well...
it's quite simple actually....

https://msmvps.com/blogs/deborahk/archive/2009/07/23/writing-data-from-a-datatable-to-excel.aspx

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.....

or..

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 article has been dead for over six months. Start a new discussion instead.