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]

Reply via email to