This clipped code:
oTextCursor.goToRange(oPor.getStart(), False)
oViewCursor.goToRange(oTextCursor, False)
oTextCursor.goToRange(oPor.getEnd(), False)
oViewCursor.goToRange(oTextCursor, True)
select text portion (oPor) if oTextCursor was created in document body (ThisComponent.Text) and oPor is his paragraphs or text portions, but if oTextCursor and oViewCursor was created in this way:
oPageStyle = ThisComponent.getStyleFamilies.getByName("PageStyles").getByName(oPageStyleName)
REM In thi place - enumeration of paragraphs and textPortions(oPor) in oPageStyle.FooterText.Text
oTextCursor = oPageStyle.FooterText.Text.CreateTextCursor()
oViewCursor = ThisComponent.CurrentController.getViewCursor()
oTextCursor.goToRange(oPor.getStart(), False)
oViewCursor.goToRange(oTextCursor, False)
oTextCursor.goToRange(oPor.getEnd(), False)
oViewCursor.goToRange(oTextCursor, True) <----
, then text selection failed.
How to select text portion in Footer or Header?