How to access a graph in Word from VSTO 2005

A

AndersN

Hi, in the sample application "Word Controls" a Graph chart is accessed by
its "parent" shape named "Example4Chart".
How is this shape created and how is it named?

This is the sample code that finds the reference to the Graph.chart object:

// Activates the embedded object first.

object chartName = "Example4Chart";

Word.Shape example4Chart = this.Shapes.get_Item(ref chartName);
example4Chart.Activate();

// Accesses actual Graph.Chart object.
Graph.Chart chart = null;

try
{
chart = example4Chart.OLEFormat.Object as Graph.Chart;
chart.ChartType = chartType;
}

Thanks for your help
 
A

AndersN

OK, I found it.
Using VBA in imidiate window fixt it.

activedocument.shapes(3).name= "ABC"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top