0

Trying to convert ASPX file to XLS file.

File gets downloads with the data with row count (17K records) and actual data in DATAGRID is (20K records)

And If I manually copy the records from DATAGRID and paste it in Excel all records gets pasted all(20K records).

Please find the below code which executes to download excel(.xls) file.

    Response.ClearHeaders()
    Response.ContentType = "application/vnd.ms-excel"
    Response.AddHeader("Content-Disposition", "attachment; filename=Test.xls")
PrasadK
  • 23
  • 5
  • Start using a specialized library for creating Excel files, like [EPPlus](https://github.com/JanKallman/EPPlus). [Example here](https://stackoverflow.com/a/47293207/5836671) and [here](https://stackoverflow.com/questions/52002573/send-excel-email-attachment-c-sharp). All you are doing now is creating a HTML page with an .xls extension. – VDWWD Jan 04 '21 at 14:23
  • I have a aspx page...now i want to download this page in excel format on a button click...how to do this??? i have to download both table & Datagrid control in one page and Datagrid will be having dynamic column also – PrasadK Jan 05 '21 at 08:00

0 Answers0