Published: Wednesday, February 21, 2001
Charting with Office Web Components (OWC)
By Bret Hern
Introduction
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.
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!