Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I have a method that use Microsoft.Office.Interop.Excel class to export a DataTable to a .xls file. Everything is ok untill I got a request that the excel need to have some text rows before displaying the data in DataTable, such like following:

TITLE OF THE EXCEL

Label1 Param1
Label2 Param2

COLUMNHEADER1 COLUMNHEADER2 COLUMNHEADER3 COLUMNHEADER4
.... .... ...... ......
.... .... ...... ......
.... .... ...... ......

I have tried with DataTable.Merge(...) method but it returned with the COLUMNHEADERS AT THE TOP OF THE EXCEL, like this:


COLUMNHEADER1 COLUMNHEADER2 COLUMNHEADER3 COLUMNHEADER4
TITLE OF THE EXCEL

Label1 Param1
Label2 Param2
.................. .................. ........................ ........................
.................. .................. ........................ ........................
.................. .................. ........................ ........................


Any suggest is appreciated. Thanks in advance.
Posted
Comments
bluesathish 20-Nov-13 2:27am    
Have you tried to append your lines (using some writer methods) before export the data from datatable?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900