问题
I am developing a web application that contains a great deal of reporting. The reports are fairly basic, but some have multiple datasets or embedded charts. One of the key requirements is that each report can be exported to Excel. The Excel version of the report is disconnected and should look the same (or very similar) to the web report. That includes formmating of values, cell styles, number of rows/columns, charts, etc.
The problem I've encountered is that the ASP.Net reporting tools I've looked at do a great job in creating the report, but the export to Excel is not as robust as I'd like. The ASP.Net spreadsheet tools do a great job generating an Excel sheet, but they don't offer a way to view the information in a browser without downloading them locally and viewing them in Excel.
Any suggestions? Thanks!
回答1:
MS Reporting Services that comes with SQL server produces pretty high fidelity Excel spreadsheets.
Otherwise you could do this with MOSS Enterprise using Excel Services and the Excel Viewer web part.
回答2:
Infragistics has some fairly robust web controls, one of them is a grid that can export to Excel. The Excel export component allows you to format the results, add images and other stuff, so it should do what you are after.
The only problem with Infragistics is that their API is extremely ... what is the word ... cumbersome? So it takes some work to get used to and often much code to get things done properly. But the end result is good.
回答3:
If you only want to generate Excel documents which are just cell data and not charts you can use the XML markup for Excel, no not the OpenXML spec version but the standard Microsoft Excel XML format.
I've got an example of how to achieve that on my blog: http://www.aaron-powell.com/blog.aspx?id=1237. If you do want to do charting I'm not 100% sure if it's supported that way.
回答4:
You could use SpreadsheetGear to generate the Excel version of your report, complete with macros and formatting. The product give you complete programmatic control for creating a 97 - 07 compliant spreadsheet.
来源:https://stackoverflow.com/questions/236185/asp-net-web-server-control-that-generates-html-and-excel