P
PromisedOyster
I use Microsoft Word extensively to automate the production of graphs.
I am now attempting to create charts dynamically using the
"MSGraph.Chart.8" control.
Basically, there are 0 to many charts in a document. I iterate through
the charts in a document using the following code
_wordApp.Selection.WholeStory();
foreach (Word.InlineShape shape in _wordApp.Selection.InlineShapes)
{
}
I then attempt to populate the data on the chart and that is when
things go bad. For example:
Graph.Chart chart = (Graph.Chart)shape.OLEFormat.Object; // This
generates invalid case exception.
chart.Application.DataSheet.Cells[1, 1] = "11";
I believe the above works using Office XP, but not Office 2000?
Is there something I am doing wrong?
Perhaps there is an alternative way to achieve this without attempting
to case to a Graph.Chart object?
Notes:
When I add a reference for the graphs, I am using graph9.olb.
I have tried the ActivateAs method but to no avail.
Unfortunately we cannot force our users to Office XP.
I am now attempting to create charts dynamically using the
"MSGraph.Chart.8" control.
Basically, there are 0 to many charts in a document. I iterate through
the charts in a document using the following code
_wordApp.Selection.WholeStory();
foreach (Word.InlineShape shape in _wordApp.Selection.InlineShapes)
{
}
I then attempt to populate the data on the chart and that is when
things go bad. For example:
Graph.Chart chart = (Graph.Chart)shape.OLEFormat.Object; // This
generates invalid case exception.
chart.Application.DataSheet.Cells[1, 1] = "11";
I believe the above works using Office XP, but not Office 2000?
Is there something I am doing wrong?
Perhaps there is an alternative way to achieve this without attempting
to case to a Graph.Chart object?
Notes:
When I add a reference for the graphs, I am using graph9.olb.
I have tried the ActivateAs method but to no avail.
Unfortunately we cannot force our users to Office XP.