OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

accessing a chart embedded in a text doc

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
bryancole
OOo Advocate
OOo Advocate


Joined: 13 Jun 2003
Posts: 305

PostPosted: Thu May 13, 2004 9:13 am    Post subject: accessing a chart embedded in a text doc Reply with quote

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
View user's profile Send private message
bryancole
OOo Advocate
OOo Advocate


Joined: 13 Jun 2003
Posts: 305

PostPosted: Thu May 13, 2004 9:57 am    Post subject: figured it out in the end! Reply with quote

Very Happy 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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group