Building Dazzling Charts With Office Web Components

Posted on June 08, 2004   |   Download sample code


Need to create eye-popping charts in real time and do it at no cost at all? Give Microsoft Office Web Components a try.

Any time you need to add killer 3D charts to your web application you probably jump online and start looking for component vendors. Or you open up an issue of the MSDN Magazine (which looks more like a JC Penney catalog these days, no less) and do the same. I think charting components are way overpriced and overrated. I'd like to know how many people actually use triple nested datagrids? No, really? I'm not talking about MSDN articles which do it for show-and-tell. I mean real-life solutions. Before you blow the bank take a close look at the Microsoft Office Web Components.

Ever since Microsoft Office 2000 every version of Office shipped with a set of charting web components: Office 2000 Web Components (OWC9), Office XP Web Components (OWC10) and finally Office Web Components (OWC11). By definition,

Microsoft Office Web Components are a collection of Component Object Model (COM) controls for publishing spreadsheets, charts, and databases to the Web.

Web Components work in two modes:

  • Interactive (dubbed "Design-Time and Run-Time Interactive")
  • Static (dubbed "Run-Time Static")

You see, if you run a copy of Office on your computer and access a web page that has web components as ActiveX controls you can interact with pivot tables, spreadsheets, charts, etc. The functionality of these controls in the interactive mode surpasses that of many component vendors out there! I won't cover this mode here. Check out help files to learn more.

In the static mode

Installation and use of the Office XP Web Components does not require a valid Office XP license. However, components installed in this manner can only be accessed in view-only mode.

This is exactly what we need—to build a chart and display it as a jpg/gif/png. In this case no license is needed and you can redistribute Web Components for free (unless I'm misreading the license agreement). I'll dedicate the rest of this article to the static mode.

What's In The Web Component Pack?

A couple of very slick components: Chart, PivotTable, and Spreadsheet components. We're going to talk about charts.

Where Do I Find Help Files?

Before we move on I want to draw your attention to the documentation. I won't be able to explain every term and notion related to Web Components. The documentation covers all this in great details with lots of pictures and explanations. Provided you installed the latest version of Web Components (i.e. the Office 2003 ones) you can find help files in \Program Files\Common Files\Microsoft Shared\Web Components\11\1033. The charting component help file is OWCDCH11.CHM.

Where Do I Start?

First you install Web Components. I suggest the latest ones. If you run a copy of Office chances are they are already installed. Is it safe to install them on a server? Yes. You need them where your web code will be running. In the days of Office 2000 people used Word and Excel COM objects to create server-side "reports" and stream them to the client's browser. There are ample articles out there urging against this practice. Neither the Word nor Excel object hierarchy was meant for server-side report generation. Start with KB 257757, Considerations for Server-Side Automation of Office, and follow cross-references to other KB articles. There are plenty of them. This short disclaimer says it all:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when run in this environment.

Office Web components address this problem by accommodating server-side deficiencies of Office Automation controls.

Remember though: Office Web components are COM servers. This means COM interop once we start using them in ASP.NET. Keep this is mind.

Add A Reference to OWC11

Fire up Visual Studio.NET, create a new web project, right click Add References..., switch to the COM tab and find Microsoft Office 11.0 Object Library:

Add reference to Web Components

Make sure it appears in Selected Components and click Ok . Next, add the following line at the top of your code-behind file:

using OWC11;

Build Categories And Values

The discussion of nuts and bolts of building a chart can grow boring really fast. I'll only outline the basic steps and let you download and play with a sample.

I decided to build a sample chart of some 2004 Honda cars (being a Honda addict myself). I wanted to plot 3D columns with car names and their base model prices. First off, I defined "categories" (model names) and "values" (car prices). Basically, these two become the X and Y axis of a chart.

string[] chartCategoriesArr = new string [] 
     {"Accord Coupe", "Accord Sedan", 
      "Civic Coupe", "Civic Sedan", "Civic Si"};

string[] chartValuesArr = new string []
     {"19400", "15900", "13710", "13010", "19070"};

string chartCategoriesStr = String.Join ("\t", chartCategoriesArr);
string chartValuesStr = String.Join ("\t", chartValuesArr)

I figured the charting component wanted its categories and values TAB delimited which is exactly what the last two lines do. I need to warn you up front: category values should not contain commas because the charting component splits them on commas. Also, values should be convertable to integers. No commas or periods in values. Plain numbers work best.

Next, you create a chart workspace which is the top-level chart container. The workspace can contain more than one chart.

OWC11.ChartSpaceClass oChartSpace = new OWC11.ChartSpaceClass ();

At this point you set the chart type. The ChartChartTypeEnum enumeration contains 67 chart types! Even the most picky developer will find an appealing chart. Among these are 3D and 2D areas, bars, columns, stacked bars, clustered columns, 3D pies, doughnuts, radar lines, polar markers, and so forth. For this sample I chose a 3D column chart:

chartType = ChartChartTypeEnum.chChartTypeColumn3D;

The rest is beautification. You set the chart border color, aspect ration, chart depth, chart caption, location of the legend, etc. You also feed the chart those "categories" and "values" you defined previously.

In the end you have the chart component actually produce an image:

byte[] byteArr = (byte[]) oChartSpace.GetPicture ("png", 500, 500);

I chose PNG but feel free to choose GIF or JPG.

How Do We Send The Chart To A User?

This is where a lot of faithful folks drop the ball when they talk about Web Components. You have a byte array with a built chart on your hands. How do you stream it? The easiest (and dirtiest) solution is to store it on the hard drive and put a link to it on the page. Let the browser download it. This technique turns your hard drive into a junk yard and hurts performance on IO operations. Neither will this work in a web farm environment.

This is where an HttpHandler in tandem with the MemoryStream class work their magic. Let me explain. You can write an HttpHanler, put it in an ASHX file and refer to it as if it were a plain page. I described this technique in my blog post, Code-Behind For HTTP Handlers. So here's what we do: we put our byte array in the Session, identify it by a random GUID and pass this GUID on to the HttpHandler.

HttpContext ctx = HttpContext.Current;
string chartID = Guid.NewGuid ().ToString ();

ctx.Session [chartID] = byteArr;
imgHondaLineup.ImageUrl = string.Concat ("chart.ashx?", chartID);

In its turn the handler reads the byte array back, sets the correct Content-Type of the response and streams the chart image. Remember, a browser downloads each image separately which is why this trick is needed.

public void ProcessRequest (HttpContext ctx)  {

string chartID = ctx.Request.QueryString[0];
Array arr = (Array) ctx.Session [chartID];

ctx.ClearError ();
ctx.Response.Expires = 0;
ctx.Response.Buffer = true;
ctx.Response.Clear ();

MemoryStream memStream = new MemoryStream ((byte[])arr);
memStream.WriteTo (ctx.Response.OutputStream);
memStream.Close ();

ctx.Response.ContentType = "image/png";
ctx.Response.StatusCode = 200;
ctx.Response.End ();

That's it. We're done. One sticky point is whether to delete the image from Session or not. If you delete it right away and the user refreshes the page only a placeholder will appear in its place. Not pretty.

Hey, look what we've built:

Honda mode/price chart


Another Honda model/price chart

Change the chart type to chChartTypeBar3D and you get this:

3D pie chart of Honda prices

Gotcha #1

I noticed this one by accident. Apparently the charting component heavily relies on DirectX. These days the Windows Update service will nag the heck out of you to upgrade to the latest version of DirectX so I wouldn't worry about this too much.

Gotcha #2

I honestly don't know if any hosting companies have Office Web Components installed and whether they will agree to if they don't. My host (CrystalTech) refuses so far, therefore I can't run the sample live. To make matters simple for them I hacked the installation and figured that registering OWC11.DLL alone is sufficient. They refused to register even that one DLL. See if you have better luck.


I hope this article introduced you to the power of Microsoft Office Components. I don't quite understand why they are so little advertised by Microsoft itself. Right at your fingertips you have functionality that most component vendors can't even match, and this functionality comes for free. Explore, experiment and build dazzling charts without destroying your budget!

July 4, 2005, update: OWC object model and terminology banner is now available.


Jay Wang
on June 24, 2004

Congratulations, Milan. You did a great job on the artical.

I think there is a minor type. Instead of switch to the COM tab and find Microsoft Office 11.0 Object Library: , it shoudl be switch to the COM tab and find Microsoft Office 11.0 Web Component: .



on July 09, 2004

I downloaded and succesfully ran your application. It's awesome. I carefully converted it to VB, but it doesn't run there. Stepping through the debuggers, everything look similar. I'm stumped. Do you have a running VB version?

Milan Negovan
on July 09, 2004

Paul, I don't have a VB.NET version yet. But since you asked... I'll give it a try too.

Milan Negovan
on July 11, 2004

Paul, I've added a sample VB.NET project to the downloadable code. Have fun. ;)

on July 14, 2004

Any word on how to set up an interactive chart?

Milan Negovan
on July 14, 2004

Well, it's a whole different story that involves ActiveX controls and stuff like that. If you download the OWC10/11 redistributable you'll find a bunch of help files in it: one for each component and one for everything. They provide samples of how to use these components interactively.

on July 15, 2004

I'm very interested in getting this to work on my development machine, but I keep getting the same error over and over:

System.InvalidCastException: QueryInterface for interface OWC11.ChChartSpace failed.

The error occurs on this line of the VB sample app:
oChartSpace.Border.Color = "white"

Any ideas? It must have something to do with how the Office components are installed on my machine, but I have no idea what it could be. I'd enormously appreciate any help you can give.

Milan Negovan
on July 15, 2004

Well, the samples I provided used an interop assembly with OWC11, which is Office 2003. Is there a chance you installed OWC10 (Office XP) or OWC9 (Office 2000)?

Also expand "References" in your project and see if there's a yellow "warning" icon next to "OWC11". If there's one I suggest you re-add a reference to Microsoft Office Web Components 11.0 as explained in the article.

All in all, it makes little difference whether you use OWC11, OWC10 or OWC9. I haven't noticed any changes among these versions. You'll need to simply change references throughout your code.

That should be pretty much it. Let me know how it goes.

Rebecca Clarke
on July 27, 2004

I trying to use OWC11. On the statement 'Set pTable = frm.PivotTable', I get a Type mismatch error 13. If I define pTable as an Object, I don't get this error. Can you tell me why OWC11 is not working for me. I'm using MS Access 2003. The references I have are Visual Basic for Applications, Microsoft Access 11.0 Object Library, OLE Automation, Microsoft Office Web Components 11.0 and Microsoft ActiveX Data Objects 2.8 library.

Dim frm As Access.Form
Dim pTable As OWC11.PivotTable
Dim pFieldset As OWC11.PivotFieldSet
Dim pField As OWC11.PivotField
CustomerCountProdID = "Allocate"
RecordSource = "SELECT ProdID, Date, Total, Comments FROM CustCounts WHERE (ProdID = '" & CustomerCountProdID & "')"
Set frm = Forms("CustCounts")
Set pTable = frm.PivotTable

Thank you,


Milan Negovan
on July 29, 2004

Rebecca, quite honestly, I don't know why it's happening. I haven't worked with Access and VBA for a very long time now.

on August 20, 2004

Great article Milan.

I am having the same problem as Neil on my development machine, but the code works fine on 2 other servers. Stumps me.

Hey, Neil: were you able to get around the "System.InvalidCastException: QueryInterface for interface OWC11.ChChartSpace failed." error on your dev. box.

Anyone else having similar problem and then fixed it, I am curious to know too. Thx.

on August 29, 2004

I have the same type of problem.
But when I am running the application in my local machine, it is working fine , but when puting the files(dll, *aspx) into real web server then I am getting the error.
Any idea ...............

Milan Negovan
on August 29, 2004

Is your real web server managed by a hosting company? Usually, they are reluctant about installing any COM objects. My hosting company has refused so I can't run a live sample. :(

on September 14, 2004

I wanted to change the category values (from honda types) to dates. Still wrapped in double quotes and the array declared as a string I didn't think there would be a problem. The format is....
{"dd/mm/yy","dd/mm/yy".... etc}
However when I view the page the dates aren't what is expected.
The following values:
Dim chartCategoriesArr As String() = {"17/09/04", "18/09/04", "19/09/04", "20/09/04"}

shows on the image as:
01/01/25 01/01/32 01/01/39 01/01/46
Notice the pattern? +7 each time.
The chart type is
chartType = ChartChartTypeEnum.chChartTypeLineStacked

any ideas what is going on?
These are simply meant to be labels along the bottom of the graph

Milan Negovan
on September 16, 2004

In the article I mentioned you could only use integers. As I figured out later, it's not quite correct. You can use just about anything as long as you indicate their types. I need to dig through documentation and find it.

I think in your example the dates are treated simply as strings which is incorrect.

on September 20, 2004

Apparently .net/excel(???) was trying to treat them as dates even though they were dimmed and supplied as strings. A colleague of mine gave me this line:
oChartSpace.Charts(0).Axes(0).GroupingType() = oChartSpace.Constants.chAxisGroupingNone

and it stopped the problem. Got a new problem now!
For some reason I now get invalid parameter errors ( version) seems there is no value (according to debug/command window) for oChartSpace.Charts(0).SeriesCollection(0)

In the command window I type
? oChartSpace.Charts(0).SeriesCollection.count
and it returns 0

I'm sure I haven't changed anything (in this area) does the series collection need to be manually added to the charts(0)?

on September 20, 2004

Oops ignore the previous msg!
I'd commented out
for some reason (blush!).

Last question (I promise!)
How can I use "x"s to plot on the chart rather than the actual values?

Milan Negovan
on September 21, 2004

Quite honestly, I don't know. Anyone?

on September 21, 2004

I think it may be a subset of

but I can't make anything out of the MSDN/VS.Net documentation!

on September 30, 2004

I have downloaded your sample code.
It's very easy to read.
the chart comes out as a 2D and not 3D chart.
Your article shows 3D pictures.
Am I missing anything?
I didnot modify your dowloaded code at all.

Please, repond.


Milan Negovan
on September 30, 2004

Marina, I had that happen to me when my DirectX was way out of sync with the latest codebase. Go to Microsoft's update site and pull down the latest DirectX. That's what OWC controls bank on for 3D effects.

Mohammed Mudassir
on October 04, 2004

Hello Milan,

Great article I am able to make it generic and it is working cool.

One query, wot is the Series mean? wot the define? wot is the purpose? And does this xample gonna work with "Stock Chart?"

Take Care,


San Jose, CA

Milan Negovan
on October 05, 2004

Mudassir, check out the help files I mentioned in the article. They have nice charts there that visually explain all these notions.

Adolfo López
on October 13, 2004

Excelent article Milan.
Because I've Office 2002 I added OWC 9.0 but when I tried to compile project it was giving me several errors that I presume are because I'm nout using OWC11, I commented such code lines (e.g
oChartSpace.Charts[0].SeriesCollection[0].DataLabelsCollection[0].Font.Name = "verdana";)
When I arrive at this code line:
byte[] byteArr = (byte[]) oChartSpace.GetPicture ("jpg", 500, 500);
I was not able to continue, the error: OWC.ChartSpaceClass doesn't contain a definition to GetPicture.
Do you know how can I solve it?
Remember I'm using OWC 9.0
I'll appreciate your help

Mexico City

Milan Negovan
on October 14, 2004

Adolfo, quite honestly I don't know. It seems they didn't have this method back then or named it differently. I suggest you look up the ChartSpace class in documentation and see what the proper method and syntax are.

Adolfo López
on October 18, 2004

Hello Milan:
I modified my project to better use OWC11 instead OWC.
In chart.ashx.cs and default.aspx I changed png for jpg, but when I run project omage imgHondaLineup apprear as this weren't therein (only shows a red "X").
What have I wrong?
Please reply me.

Milan Negovan
on October 18, 2004

Hmmm... The original sample code uses PNGs for images. The only two things to watch out for are the proper content type (ctx.Response.ContentType = "image/png") and actually creating a PNG image (GetPicture ("png", 500, 500)).

on October 21, 2004

On my development version my 3d charts works fine. However when I place the code on another server 3d charts appear as 2d graph types. I am currently using oWC10 and on the second server I have downloaded the current version on directX.

Does anyone know what is missing from my real web server.

Max Etere
on December 02, 2004

Hi guys!
I've a problem with the examples: doesn't work! :o(
I open the VB.NET example and I click on "Run" and appear this error message:

"Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged."

What is this nightmare???

Thanks to all

Milan Negovan
on December 02, 2004

Open up web.config, find the "compilation" tag and set debug="true".

Max Etere
on December 02, 2004

It's already set to true! :o(

Max Etere
on December 09, 2004

Ok! I've understand where is my problem!
The project path doesn't work 'cause it's not configured into IIS!
I've Windows Italian version and I'm not sure to translate correctly:

Follow this steps:
Open "Control panel" -> "Administrative tools" -> "Internet Information Services"

On left the're a tree with your computer name -> Web sites

Right click on "Default Web Sites" -> "New" -> "Virtual directory"

I hope that help!

Now it's fully functional! Great work Milan!

on January 17, 2005

Hi all,

Milan, thanks for the great article. I am trying to create the chart using your example and I am getting an error. Can you please inform me on what could be wrong. As far as i can tell, i have copied all code correctly. The code in the web form runs smoothly. I have downloaded the most recent version of OCX11.dll. I am getting an error with the chart.ashx file. When i run the web form, i get a broken image icon and the following error when i try to load the .ashx file directly in IE:

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not create type 'OwcCharting.Owc.ChartHandler'.

Source Error:
Line 1: <% @ WebHandler language="vb" class="OwcCharting.Owc.ChartHandler" codebehind="chart.ashx.vb" %>

Source File: c:\inetpub\wwwroot\OwcCharting\chart.ashx Line: 1
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

Milan Negovan
on January 18, 2005

I tried to provide samples for educational purposes so you could simply pull in the code into your projects and go from there. Perhaps, I should've included a compiled assembly.

This is exactly what's happening. The page tries to reference a compiled DLL which is not there. You either need to compile the sample or copy and paste the code into your own app.

on January 18, 2005

Too funny. That was exactly the problem. Gotta say, the article is awesome. Thanks for writing it and thanks also for the super fast response!


on January 31, 2005

I am trying to create a line chart that will display multiple lines. I have successfully created one line, but would like to have multiple lines. I hope this question isn't too newbie, but I haven't used Office Components before. Thanks!

on January 31, 2005

I answered my own question. I just needed to add a new Series Collection to the Chart object and then set the data for it.

// add the new series collection

// add the data for the new series collection
oChartSpace.Charts[0].SeriesCollection[1].SetData(OWC11.ChartDimensionsEnum.chDimValues, Convert.ToInt32(OWC11.ChartSpecialDataSourcesEnum.chDataLiteral), the_new_data_array);

on February 01, 2005

I'm back. Never did get that puppy to run. I've tried using both the OWC10 and OWC11 libraries, and I've tried it in C# and VB ... I always get the same error:

QueryInterface for interface OWC11.ChChartSpace failed

on the line

Guess it's just one of those things. I can't figure out why it comes out "ChChartSpace" - what's with the extra "Ch"? (Sigh.)

Milan Negovan
on February 01, 2005

For some reason the code just can't find the right COM objects. Strange indeed. I think something is up with the installation.

To answer the second part of your question: the COM-callable wrapper (CCW), created for Office web components, has its own majic and changes naming around a bit. If you refer to the help files provided with OWC, you'll see that ojbect and method names differ from those inferred for the CCW. That's just the nature of the beast. I had to hack it because there's no .NET documentation for OWC.

on February 10, 2005

Great article!

I have a couple of funny ones to ask. Firstly when i publish on my webserver with office 2000(OWC9) on it and there are many columns on it does not write the column names vertically like it does on my development box with OWC11, It instead breaks up the column names into small fragments. Is this a known problem? Will it be solved by installing OWC 11?

Secondly when I try and create a graph of multiple types ie bar graphs with line graphs over it, it stops me from having more than one graph of the second type. Does OWC support this and if so can you point me in the write direction?

Milan Negovan
on February 10, 2005

If you feed too many columns/rows, the OWC chops descriptions with an ellipsis so it can fit them all. You just need to play with different types of charts and see which one works. Or try to plot against a smaller set.

I'm not sure how to answer your second question. I don't think you can combine multiple charts in one. You'd have to build each chart separately. Now, you can still build "clustered" charts which are "more of the same", i.e. they will stack up on top of each other, or behind each other.

zameer syed
on February 18, 2005

Hi Milan,
I found your article very helpful.I have just started to learn about web components.I wanted to create a stacked column chart and i was trying to figure how i can stack the columns.Can you advice.

Milan Negovan
on February 19, 2005

In the source code try setting the chartType variable to chChartTypeBarClustered, chChartTypeColumnClustered, or chChartTypeLineStacked enumuration and see which one works better for you.

Zameer Syed
on February 19, 2005

This is in reference with the previous question i asked and your answer.What i wanted to know was,in your example your use two arrays one array lists the name or Categories,and the other list values.And you add it to the chart space using oChartSpace.Charts[0].SeriesCollection[0].SetData (some arguments).In case of stacked i have three arrays.1-categories(car names),2- values(% of good cars),3-values(% of bad cars).how can i stack values from array three on array three.For ex.Accord Coupe had 75% good cars and 20%defective.I want 75% in green,over that 25% in red on my stack graph.Same case for all other cars,good cars in green and defective in red.I hope you understand what i am trying to tell.

Milan Negovan
on February 20, 2005

Well, if I understand your question correctly, you can use the chChartTypeColumnStacked1003D chart type to stack values on top of each other. Each range within a column will be colored differently, and all values will add up to 100%. Try this setting and let me know if this is what you're after.

Vinod Iyer
on February 21, 2005

Hi Milan,
The article was very helpful to me. I am also trying to display data from backend(access, sql server) on to a web page(intranet) and need to do that in the form of a excel sheet. Also need to export the same to an excel sheet to the client pc. Have seen the toolpack for office xp web component, but could not make the code snippets work. Would you suggest any good books for the same which has some helpful code samples so that i can get up to speed.
Any help is appreciated...

Milan Negovan
on February 22, 2005

Unfortunately, there's almost no documentation on OWC short of help files shipped with them by Microsoft.

If you need reports in Excel form, I suggest you look into using them as ActiveX controls because the "static" view I described here would hardly cut it.

Zameer Syed
on February 28, 2005

I am trying to generate charts with OWC9 not owc11 and there is not getPicture method in OWC9,DO you know what i have to use in OWC9 to do same functionality as getPicture of owc11.

Milan Negovan
on February 28, 2005

Zameer, no, I've never worked with OWC9. Sorry.

Giles Hamson
on March 14, 2005

Currently using OWC11 for web based reporting (returning data from a database and charting it)...

Various reports of mine have drill down functionality and it would be nice to be able to link from each section in a graph...

For Example...

Bar Chart - Bar 1 links to Page 1, Bar 2 links to page 2 etc...

I have had a look and I can only see a way to link a whole series of data to one particular page...

Any thoughts?

PS. Thanks for the article, it was very helpful...



on March 16, 2005

Hi Milan,
i have been trying this for few days hope you could help.I am building a stacked chart,if one value in stack is zero,i dont want it to display it as zero but as blank value.for example the array is(5,3,0,2,0) DO you know how i can do it.One bar which is stacked one on top of other.

Milan Negovan
on March 16, 2005

I wish I could help, but I've never dealt with blanks in my charts. Have you tried setting it to something very, very small, such as 0.01?

Milan Negovan
on March 17, 2005

Giles, what you're talking about should happen client-side and has little to do with image generation per se.

You would need to create a map or something for people to click on. I don't know if this can even be done because you would have to have exact coordinates of each slice in a pie chart, for example.

I suggest you look into a Flash-based approach if you need interactivity with a chart.

Giles Hamson
on March 23, 2005

Thanks for looking into it, i shall take a look at the flash approach, I believe swiff chart is good for this kind of thing...

Many thanks


David A
on March 29, 2005

Very nice article. I was researching OWC all day yesterday and this is the best article I found on the web. There is a book being released on OWC11&.net: which looks decent. I will probably wait to buy it until I read some reviews though.

on March 30, 2005


Fantastic article. I have developed a site with charts using OWC on the server side. Do you or anyone know of a hosting company that supports them?

Thanks in advance,


Milan Negovan
on March 30, 2005

One of my readers said he convinced his ISP, CrystalTech, to install OWC11 on their server. I'm with CrystalTech too, but I haven't approached them yet. I don't think any providers have them pre-installed.

All you have to do is ask your ISP's tech support if they would install OWC11. Give them links to Microsoft's site so they can see it's a piece of perfectly legit software.

Alvin Bruney [ASP.NET MVP]
on April 01, 2005

In your article you mention: In this case no license is needed and you can redistribute Web Components for free (unless I'm misreading the license agreement).

This is not correct. It is a violation of the terms of licensing to redistribute the Web Components. Please update this information. The licensing agreement may be found in the toolpack or on the Microsoft office website. Alternatively, you may open a support incident with Microsoft to rectify this issue. Licensing is complex enough to require its own chapter. Fortunately, I explore licensing of the Office Web Components in complete detail in my new book : The Microsoft Office Web Components Black Book with .NET available at I hope this helps.

Milan Negovan
on April 01, 2005

Alvin, unfortunately, my reading list is very long right now. Can you point out what is incorrect about that assertion so I can change it?

Andy Brown
on April 06, 2005

I understood Milan's comment about the Web Component redistribution to mean that, if the user has no Office 2003 license, OWC 10 and 11 allow the use of OWC "with no reservation in view-only mode" (MS kb 555075).

I don't think Milan was saying that he advocated distributing the OWC libraries themselves, instead just that a developer could create charts and redistribute them with no legal worries; possibly this is where the confusion arose? Indeed, that same kb states "Redistribution of the Office Web Components is strictly forbidden and runs contrary to the terms of use". That is, downloads of OWC must come from the MS website, not the developed application. However, as we know, we don't need the user to install OWC to view the chart images that we generate.

Perhaps, Milan, rewording to "This is exactly what we need—to build a chart and display it as a jpg/gif/png. In this case no license is needed and you can generate and output charts to the user for free, without the user needing to install OWC themselves." would keep everyone happy?

Legalities aside, thank you for the article, Milan. The real gem for me was the location of the help files, which I had pretty much given up on finding on the web, and hadn't thought out of the box enough to look on my own workstation :$

On a more philosophical bent; I think it is a shame that the OWC components are so under-appreciated and seemingly little-understood and under-supported. Excel must be one of the most powerful and widely used generic business tools, OWC provides a lot of that power, and really focuses it on the way that technology is pushing, and has been moving for a long time: distributed applications on the web. There cannot be a single developer out there who uses OWC in .NET applications who has not had to reinvent the wheel by themselves. Surely there is a need for a good collaboration between OWC+.NET developers to pool techniques, build up an FAQ list and a list of articles as good as this one to start to hold OWC to account?

Milan Negovan
on April 06, 2005

Andy, the FAQ idea is a good one! I thought about it a while ago, but besides OWC's documentation (which is VBScript and therefore doesn't have a 1-to-1 translation to .NET languages) it's hard to find good reading material. It'll definitely take a bit of hacking to document OWC for .NET devs.

I agree that these components are underappreciated. In the interactive mode, i.e. when used as ActiveX controls on desktops with Office XP/2003, it's mind boggling what they can do!

Isamu Ybarra
on April 11, 2005

Is there a newsgroup (or perhaps there *should* be one) that is dedicated to addressing office web components? or even a forum would be handy... i am just starting to develop an application which will rely heavily on the use of the charting component, and would really like to see some more real world examples of it put in use, as well as addressing some of the more obscure applications.. i think we could all benefit from this sort of brainstorming and knowledge sharing.

Milan Negovan
on April 11, 2005

I've never seen such a newsgroup.

Andy Brown
on April 12, 2005

Nothing dedicated as yet that I've seen, but try access


on April 12, 2005

Hi everybody and thanks for the great post,

i'm creating some charts (VS.Net / C# / OCW11) and i'm trying to use the SetSata Method with a DataSet filled with many records from a Database.

Is it possible to do it directly without iterating on it ( sVal += '\t' + row[0].ToString();) ?

Can i bind my dataset in the setdata function ?

and what are the different uses of the parameter ChartSpecialDataSourcesEnum ?

Thanks for help

Mike Dier
on April 28, 2005

Thanks for the article. When displaying data as a BarChart ( chChartTypeBarStacked) the categories seem to appear on the Y-AXIX and the values on the X-AXIS ..Is there a way to change this so that the chart does the reverse i.e categories on X-AXIS



on April 30, 2005

i need fully functional owc line chart with dynamic lable on chart line

Milan Negovan
on April 30, 2005

My apologies, folks, but I have to close comments. This thread turned into a forum of itself. :) Besides, I published the article quite some time ago.

If time allows, I'll compile a big fat OWC FAQ.