テキストポーション 
テキストポーションとはテキストの属性が同じ範囲を指します。たとえば、文の一部が太字になっていたりすると、その前の部分、太字の部分、後ろの部分と三つに分けられます。
オートスタイルによる属性の変化も検出できます。見た目が同じオートスタイルもテキストポーションでは別のポーションと判断されます。
テキストポーション 
テキストポーションは段落内の要素です。段落を通じて列挙としてアクセスできます。
Sub Main
oDoc = ThisComponent
oText = oDoc.getText()
' paragraph enumeration
oPs = oText.createEnumeration()
Do While oPs.hasMoreElements()
oP = oPs.nextElement()
' text portion enumeration
oTPs = oP.createEnumeration()
Do While oTPs.hasMoreElements()
oTP = oTPs.nextElement()
Loop
Loop
End Sub
すべてのルビを削除する 
テキストポーションで処理を行うとルビはそのルビが振られたテキストの1つ前のテキストポーションに現れます。実際にルビが振られたポーションの RubyText プロパティを変更するとルビが変更できます。
Sub removeRubies
oText = ThisComponent.getText()
oParas = oText.createEnumeration()
While oParas.hasMoreElements()
oPortions = oParas.nextElement().createEnumeration()
While oPortions.hasMoreElements()
oPortion = oPortions.nextElement()
If oPortion.TextPortionType = "Ruby" Then
If NOT IsEmpty(oPortion.RubyText) Then
If oPortions.hasMoreElements() Then
oPortions.nextElement().RubyText = ""
End If
End If
End If
WEnd
WEnd
End Sub
ルビを振る際にルビが区切られることがありますが、それを利用して入力したルビの場合には空のルビポーションが間にあることがあります。その場合、つづくポーションはテキストではなく次のルビパートになっています。空のルビテキストは無視すべきです。
ルビのポーションの場合 TextPortionType が "Ruby" で、空のポーションの RubyText は "" (空文字列) ではなくて Empty です。