When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles
Related Web Technologies
User Tips!
Coding Tips

Sample Chapters
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Stump the SQL Guru!
XML Info
Author an Article
Print this page.
Published: Wednesday, February 21, 2001

Charting with Office Web Components (OWC)

By Bret Hern

For More Information on Graphing...
For more information on creating graphs using ASP be sure to check out the Graphing with ASP Article Index! There you will find articles on using a multitude of approaches to create graphs using ASP!

- continued -

ALSO! You can use the Office Web Components to create Excel spreadsheets on the fly through an ASP page! Be sure to read Creating Excel Spreadsheets with Office Web Components (OWC) for more information!

Microsoft's Office Web Components (OWC) provide a flexible (albeit minimally documented -- grrr!) mechanism for charting/graphing data. In an intranet environment where certain browser and productivity software (i.e., IE 5 and Office 2000) can be assumed to be on the client, Office Web Components can be used to provide an interactive graphical exploration environment, complete with drill-down capabilities and the like. In this mode, the client workstation is heavily leveraged in the delivery of the full solution.

In the wider Internet environment, where the latest version of Excel is not guaranteed to be found on your user's desktop, Office Web Components can still be used effectively to deliver quality graphic representations of your data, without the HTML slugfest that would be required otherwise. Besides providing a familiar component-based programmatic scheme for defining charts, OWC also offer a wide range of presentation options, from traditional bar and pie charts to esoterica such as polar charts. This latter mode of operation relies on the OWC's ability to be exported as a standard GIF and downloaded to the browser like any other image.

Licensing Issues
Microsoft has some pretty strict licensing issues on using Office Web Components in the Internet-world (as well as on an intranet). Before you begin using Office Web Components on your Web site be sure to read Microsoft's Licensing Agreement for OWCs.

There are a number of articles that cover the ins and outs of scripting against OWC (see Making Charts in ASP or Microsoft's documentation), but for those who are interested in a basic example, what follows is a blow-by-blow description of a simple but fairly typical solution involving OWC.

Installing Office Web Components
The documentation on OWC is spotty, but fortunately the installation process is trivial, assuming you have the ability to install software on your web server. (A big assumption in some environments, I realize.) Simply take a legal, licensed copy of Office 2000 and run the setup process on your web server. Choose a custom install, and deselect every option except for Web Components, found under the Tools heading. (You can, of course, install the full blown version of Office 2000 on the Web server if you like - what is important is that the Web Components be installed.) Setup does the rest, including the component registration. (For more information check out: Requirements for Office Web Components!)

Development Environment
The example that follows has been tested in an IIS 5.0/Windows 2000 server environment with IE 5.0 and 5.5 as the browser. MSDN assures us that other browsers (Netscape 4.x and up, most notably) should be fine, too; indeed, that is pretty much the point of this whole method, that it does not put unrealistic expectations on the client environment.

Because my example leverages data in a database, you will see references to the ADO enumerated constants in places; the usual

<!-- #include virtual="/mypath/adovbs.inc" -->

takes care of that. (To learn more about adovbs.inc be sure to check out the popular FAQ: What is adovbs.inc? Why should I use it? What benefits does it have?)

In Part 2 we'll look at a sample ASP application that creates a line graph based on information from a database table.

  • Read Part 2!

  • ASP.NET [1.x] [2.0] | ASPFAQs.com | Advertise | Feedback | Author an Article