Question

How do I generate excel reports with rich formatting including charts with a ASP.Net application?

As per http://support.microsoft.com/kb/257757 server-side automation of office is not advisable and also our admin does not allow installation of office on the server

Customer is not ready to spend a lot on 3rd party components

A must requirement is to retain the formatting used by the end user already and also use ONLY excel 2003.

Thanks

Update: We are using ExcelXmlWriter from http://www.carlosag.net/Tools/ExcelXmlWriter/Generator.aspx as it was the most fit.

Was it helpful?

Solution

You can use for example this Excel XML library for rich formatting, but unfortunately there are no charts in there.

Without any third party component and Office automation (which is really not recommended on servers) you have basically the two options as JasonS proposed.

OTHER TIPS

Two options you might consider:

1) The ReportViewer control. You can design your report, including charts, and have it output to excel. You can allow the report to be shown within the control, or bypass that and export it directly to excel. The version it will be open in depends on what the client has installed.

2) You could create a page that with the lay out you are seeking using a GridView, or plain old HTML tables with your chart images embedded. Modify the response headers so this page downloads as an excel file.

If you need to preserve Excel charts that change when data is changed in the resulting Excel file, I'm not sure if that is possible without the use of third party controls or Office automation. The options above work if you are embedding a chart image created by your asp.net app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top