Export data as Excel file from ASP.NET

后端 未结 5 1079
半阙折子戏
半阙折子戏 2020-12-17 05:27

I have data like below

AAAAAA
BBBBBB
CCCCCC
DDDDDD
EEEEEE

Now there is a button on the page, and when I click the button, the browser would

5条回答
  •  一整个雨季
    2020-12-17 05:54

    Yes, you can export the information as a csv file, and give it an Excel file extension. Excel will recognize it's not native Excel format and allows to import with a warning message. For the download, you can search the internet for regular file downloads with a custom MIME type in ASP.NET.

    Because of the warning message, the above is not the preferred way. You could also use a library to generate a native Excel file. I've used Aspose.Cells successfully in past projects.

提交回复
热议问题