Hi, Muddybeemer wrote: > Hello, > > I am writing a Java Plugin that extracts the formula string from all the > embedded OOOMath objects in a document. I do: > > XComponent xc = xEOS.getEmbeddedObject() > > to get the formula string for each formula. > > The plugin works as expected, except that after the script operates on a > document with many formulas, it then takes MUCH longer than usual to > open one of these formulas in the equation editor, which is very > inconvenient. I have narrowed the problem down to the > xEOS.getEmbeddedObject() statement. > > I thought it might be a reference problem, so I tried xc.dispose(), but > this does not help. Am I not handling the xComponent correctly? > > Any help would be appreciated. > > I'm running Java 1.6.0_15 and Openoffice 3.1 in Ubuntu. > > Regards, > > Toby >
Well I don't know whats 'much longer than usual' ... But with the Basic Macro below I extracted the content of 700 Formulas in about 15 sec. (Don't know if that is specifically slow or not though.) oDoc = ThisComponent oObjects = oDoc.getEmbeddedObjects() aText = "" n = oObjects.getCount() for i = 0 to n-1 oObj = oObjects.getByIndex(i).getEmbeddedObject() if (oObj.supportsService("com.sun.star.formula.FormulaProperties")) then aText = aText + CHR$(13) + CHR$(10) + oObj.Formula end if next i msgbox aText Regards, Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org