Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
375
Excel Export in ASP.NET using existing Template
posted

I have an ASP.NET application. I want to implement excel export.

I want to export a dataset to excel file.

Also I want to use the existing template file(myTemplate.xltx) which has header footer logo.

I searched the forum and help samples but I didn't get any example to export using template file.

Please give me some sample code to export a dataset using a Template file.

 

Thanks in Advance,

Utkarsh Bandekar

Parents
No Data
Reply
  • 44743
    posted

    You can load the template file using the static Workbook.Load method, which returns a Workbook instance. Then you can call SetCurrentFormat on that instance and pass in WorkbookFormat.Excel2007 to convert it to a normal workbook format. Then export the data to a worksheet within the workbook and save it out with the Workbook's Save method.

Children
No Data