Hi,
in my projects I often have to iterate through text portions in
OOo Writer text documents. So, when trying to adapt my older programs
to OOo 2.0 I noticed the following strange problem. Let's take
for example the following macro (which basically does nothing,
just iterates through text portions in order to access their "String"
property):
Sub IteratePortions ()
oDoc = ThisComponent
oText = oDoc.Text
oEnum = oText.createEnumeration ()
Do While oEnum.hasMoreElements
oPara = oEnum.nextElement
oParaEnum = oPara.createEnumeration ()
Do While oParaEnum.hasMoreElements ()
oPortion = oParaEnum.nextElement
Select Case oPortion.TextPortionType
Case "Text"
oPortionCursor = oText.createTextCursorByRange (oPortion, 0)
sPortionString = oPortionCursor.getString ()
Case Else
End Select
Loop
Loop
End Sub
If you run this macro on a document which is long enough, you
may notice that each time getString() is called, a progress indicator
is shown for few time, with a label which says (if I managed
to make it out) "Exporting document".
There is no such effect, if I call the "getString()" method for the
portion itself (i. e. execute oPortion.getString ()), instead of
creating an intermediate text cursor. However, intermediate text
cursors are often needed to workaround other OOo bugs, even if
creating them doesn't look necessary :(
This "exporting" looks quite irritating, not only because it
significantly slows execution of my functions, but also because
it doesn't allow me to create my own status bar indicator (which
may be quite important for long operations). So, can anybody
explain, which sort of exporting is performed here, and how can
I avoid it?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]