Sub Main
oDoc = ThisComponent 'Get the current active document.
oViewCur = oDoc.getCurrentController().getViewCursor()
'msgbox oViewCur.dbg_methods
oTextCur = oDoc.getText().createTextCursorByRange(oViewCur)
'msgbox oTextCur.isStartOfParagraph()
oTextCur.gotoStartOfParagraph(false)
End Sub
oDoc = ThisComponent 'Get the current active document.
oViewCur = oDoc.getCurrentController().getViewCursor()
'msgbox oViewCur.dbg_methods
oTextCur = oDoc.getText().createTextCursorByRange(oViewCur)
'msgbox oTextCur.isStartOfParagraph()
oTextCur.gotoStartOfParagraph(false)
rem oTextCur.gotoStartOfParagraph(false) rem 段尾
'msgbox oTextCur.isStartOfParagraph()
oViewCur.gotoRange(oTextCur,false)End Sub
本文提供了一段用于在文档中进行段落定位及操作的代码示例。通过获取当前激活的文档,利用视图游标创建文本游标,并实现段落开头的定位。此代码适用于需要在文本编辑器中进行自动化段落操作的应用场景。
3501

被折叠的 条评论
为什么被折叠?



