Hello Mathias,

Sorry, but I'm not a big programmer.

This macro inserts a formula in my text.

Sub Main
obj=ThisComponent.CreateInstance("com.sun.star.text.TextEmbeddedObject")
obj.CLSID="078B7ABA-54FC-457F-8551-6147e776a997"
sel = ThisComponent.CurrentController.Selection
range = sel.getByIndex(0)
obj.attach( range )
End Sub

But I don't know how to set the formula.

Exactly, I added this lines:
mondocument = ThisComponent
mondocument.EmbeddedObjects.GetByIndex(0).EmbeddedObject.formula="1 over x"
mondocument.EmbeddedObjects.GetByIndex(0).EmbeddedObject.setmodified(TRUE)

And I did'nt get the right formula.

Thank's for your help.
I'm working on dmaths.

Mathias Bauer a �crit :

Didier Dorange-Pattoret wrote:


Thank you Mathias.

But could you explain me how, with an example.
I tried Maformule = mondocument.createInstance("com.sun.star.Formula") without succes.



Here's something for Basic that inserts a Chart:

obj=ThisComponent.CreateInstance("com.sun.star.text.TextEmbeddedObject")
obj.CLSID="12DCAE26-281F-416F-A234-C3086127382E"
sel = ThisComponent.CurrentController.Selection
range = sel.getByIndex(0)
obj.attach( range )

Formula objects just have another CLSID, but I don't know it from
memory. Maybe it's documented in the Developers Guide or somewhere else
or somebody else can help here.

Best regards,
Mathias




-- Didier Dorange-Pattoret

http://www.dmaths.org
http://sesamath.net

S'inscrire � la liste de diffusion de dmaths: [EMAIL PROTECTED]
Ses archives: http://listes.dmaths.org/wws/arc/users
Les Forums: http://www.dmaths.org/modules.php?name=Forums
Mailing List in english: 
http://www.dmaths.org/modules.php?name=Content&pa=showpage&pid=9




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to