We help IT Professionals succeed at work.

Showing an Excel Chart on Intranet

s_arb asked

  can i show an Excel Chart With ADO connection
and ASP?
Watch Question

Hi s_arb,

Showing Excel Charts within an ASP page is possible, however it is not as fluid as might be expected.

By default the ContentType of the page is "text/html" which tells the browser to treat it as a web page. However you can change the ContentType to anything you want.

To show Excel things add this ASP line to the top of the page:
    Response.ContentType = "Application/vnd.ms-excel"

I know that to create a spread sheet it is then simply a matter of creating an html table, even if the table is generated by ASP code.

I am not sure how to do charts but I know it can be done.

I'll get back to you with an answer.

If you're running ASP.Net, then you're in luck:

However, haven't been able to find anything that will let the Excel Spreadsheet be opened as a datasource.

There's loads out there about writing to the spreadsheet, but not the retrieving data from it. I'll keep looking though!

You can use office web components on the server to create a gif image which is downloaded by the client browser. I believe all you need to install is the OWC component, but last time I played with it I had to have office installed on the web server (which sucked as far as I was concerned).
Mark FranzProject Manager

Or you can buy a Chart Component like ChartFX, or Dundas Chart, ($950!).  But check out Dundas Pie Chart Server, it's free and looks like it can pull data from any viable source. http://www.dundas.com/products/asp/pieChart/index.asp?overview.htm

ASPChart is nice too, but it's not free, http://www.serverobjects.com/products.htm#AspChart

A good article on building charts can be read here; http://www.asp101.com/articles/chris/aspcharts/




   i can add that code to my ASP programm,but  can you show me more code

for telling the server whitch chart should be displayed?
Project Manager
The charts are created dynamically, once the application processes the data a .gif file is created and then displayed.

You need to look at the code samples included with the applications listed above for details.

Setting your page type like this;

Response.ContentType = "Application/vnd.ms-excel"

Is just going to open an Excel Application in the browser window...


Thanks for your help

Explore More ContentExplore courses, solutions, and other research materials related to this topic.