Bernard Marcelly wrote:
Message de Andrew Douglas Pitonyak date 2009-02-03 16:50 :
How can I find a Formula object in a paragraph?
I used a simple enumeration of the text object, and I even found the
text section containing the formula. I only know this, however,
because I used a very simple document with simple text and a
formula (or two). The enumeration starts as follows:
oParEnum = oDoc.getText().createEnumeration()
Do While oParEnum.hasMoreElements()
oPar = oParEnum.nextElement()
If oPar.supportsService("com.sun.star.text.Paragraph") Then
oEnum = oPar.createEnumeration()
Do While oEnum.hasMoreElements()
oSect = oEnum.nextElement()
I found the formulas with yet another enumeration:
if oSect.supportsService("com.sun.star.text.TextPortion") Then
if oSect.TextPortionType = "Frame" then
oTcEnu =
oSect.createContentEnumeration("com.sun.star.formula.FormulaProperties")
Do While oTcEnu.hasMoreElements()
oTc = oTcEnu.nextElement()
oTc is the embedded formula object.
Regards
Bernard
OK, so I needed to enumerate one more time into the text content to
obtain the formulas.
I thought that I could obtain the formulas using enumeration (if
appropriately anchored), but I was not certain.
Thanks Bernard!
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]