Aidan,
I tryed out your macro and indeed: strange behaviour but I think its
comming from the fact that in the document there is just your paragraph
with only 2 words "delete and instert" the document starts with this
"redline" stuff put some extra text or even a new paragrph before the
"redline" portion and your second macro is working normaly as well
Fernand.
At 12:49 7/10/05, you wrote:
Hello All,
I am seeing a bug when enumerating text portions within a paragraph. I
have created a paragraph consisting of the word "Delete". I then turned on
Change Tracking and inserted the word "Insert" and deleted the original
word "Delete". I now have 2 redlines, a Deletion and an Insertion.
The first macro below returns the following output:
"Redline Start"
"Delete"
"Redline End"
"Redline Start"
"Insert"
"Redline End"
The second macro just moves the start range by one but just returns:
"eleteInsert"
No redline portion is being detected. Is this a bug? Am I doing something
incorrectly?
Regards,
-Aidan
rem First Macro
Sub Main
oDocument = ThisComponent
oText = oDocument.Text
oCursor = oText.createTextCursor
oCursor.goRight(0,False)
oCursor.GotoEnd(True)
enum = oCursor.createEnumeration()
While enum.hasMoreElements()
element = enum.nextElement()
newenum = element.createEnumeration()
While newenum.hasMoreElements()
newelement = newenum.nextElement()
If newelement.supportsService( "com.sun.star.text.TextPortion") Then
if newelement.TextPortionType = "Redline" Then
if newelement.IsStart Then
msgbox "Redline Start"
Else
msgbox "Redline End"
End IF
Else
msgbox newelement.getString()
End If
End If
wend
Wend
End Sub
rem Second Macro
Sub Main
oDocument = ThisComponent
oText = oDocument.Text
oCursor = oText.createTextCursor
oCursor.goRight(1,False)
oCursor.GotoEnd(True)
enum = oCursor.createEnumeration()
While enum.hasMoreElements()
element = enum.nextElement()
newenum = element.createEnumeration()
While newenum.hasMoreElements()
newelement = newenum.nextElement()
If newelement.supportsService( "com.sun.star.text.TextPortion") Then
if newelement.TextPortionType = "Redline" Then
if newelement.IsStart Then
msgbox "Redline Start"
Else
msgbox "Redline End"
End IF
Else
msgbox newelement.getString()
End If
End If
wend
Wend
End Sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]