Export dataTable to Excel from C#

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,

I neet to export DataTable to excel.
I used with  RKLib ExportData and its work well.
My code:

RKLib.ExportData.Export objExport = new RKLib.ExportData.Export("Win");
objExport.ExportDetails(dtExport, Export.ExportFormat.CSV, path + filename + ".csv");    

But . my problem is that I need to add a header row BEFORE the columns header.
I want that the excel file will be like:

<b>PERIOD:  01:(9   -  31:(9    -----row header</b>
Col 1           col 2              col 3 ....  ---------  columns header
aaa             aaaa             aaaa
bbb            bbbb               bbbb      ---data

How can I do it?????

One of the option of exportDetails function is:
public void ExportDetails(DataTable DetailsTable, int[] ColumnList, <b>string[] Headers</b>, Export.ExportFormat FormatType, string FileName);
But Headers refers to columns headers and I need other row BEFORE columns header.

I hope that someone will be able to help me...

Thanks.


View the full article
 
Back
Top