简体   繁体   中英

Create Excel file with Pivot table from a web page button

I would like to create an excel file on clicking a button on a web page created in .NET. This excel file would have multiple pivot tables. Please let me know if there is a way to create the excel file on button click and if it really necessary to save the file to create the pivot tables. I have created excel file with pivot table on a console application but have not done that in a web application.can the file be created without actually saving the file and giving the user the flexibility to Save/Open it?

Thanks,

Since you shouldn't install Excel on a server, your best option would be to create and/or manipulate an Excel file using http://en.wikipedia.org/wiki/Office_Open_XML , which is the documented XLSX format.You can use the Open XML SDK 2.0 for Microsoft Office to make your life easier.

Once the Excel file has been created/manipulated you can either save it to a temporary location on the server, then return the file via request, and delete the file. This is assuming you use IIS and either WebForms or MVC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM