The equation dose not align properly, and i need manually fixing it every time via right-click -> properties (I uploaded photos that point out the specific properties I need to change). Here the code:
Code: Select all
sub InsertMathTypeObject
dim oTargetDocument as variant
oTargetDocument = ThisComponent
dim oCurrentController as variant
oCurrentController = oTargetDocument.getCurrentController()
dim oFormula as variant
oFormula = oTargetDocument.createInstance("com.sun.star.text.TextEmbeddedObject")
oFormula.CLSID = "0002CE03-0000-0000-C000-000000000046"
oFormula.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER
oFormula.attach(oCurrentController.Selection.getByIndex(0) )
dim oXCOEO as variant: oXCOEO = oFormula.ExtendedControlOverEmbeddedObject
oXCOEO.doVerb(com.sun.star.embed.EmbedVerbs.MS_OLEVERB_PRIMARY)
end sub
thanks for your help (and sorry for my bad English)