| View previous topic :: View next topic |
| Author |
Message |
bryancole OOo Advocate

Joined: 13 Jun 2003 Posts: 305
|
Posted: Thu May 13, 2004 9:13 am Post subject: accessing a chart embedded in a text doc |
|
|
I want to alter the chart data for a chart embedded in a text document. How is this possible through the OOoBasic API?
I think once I can work out how to return the chart document object, I can manipulate the chart object easily. But how to get the list of embedded objects from the parent text doc?
The OOo API is fiendishly complex and obscure!
Thanks,
Bryan |
|
| Back to top |
|
 |
bryancole OOo Advocate

Joined: 13 Jun 2003 Posts: 305
|
Posted: Thu May 13, 2004 9:57 am Post subject: figured it out in the end! |
|
|
OK, it's easy when you know how. The following code-snip gets the chart object (XY-type) and sets the data to three values in an array:
| Code: |
Sub Main
Doc = ThisComponent
EmbeddedObj = Doc.EmbeddedObjects.getByName("Plot1")
MyChart = EmbeddedObj.getEmbeddedObject()
ChartData = MyChart.Data
a = Array(1,1)
b = Array(2,4)
c = Array(3,9)
d = Array(a,b,c)
ChartData.setData(d)
End Sub
|
where my embedded OLE Chart is called "Plot1"
hopefully someone else finds this useful.
Bryan |
|
| Back to top |
|
 |
|