本文介绍了微调goto书签libreoffice宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个libreoffice宏可以转到某个书签("qui")
I have a libreoffice macro to go to a certain bookmark ("qui")
sub vai_qui
ViewCursor = ThisComponent.CurrentController.getviewCursor()
Bookmark = ThisComponent.Bookmarks.getByName("qui").Anchor
ViewCursor.gotorange(Bookmark, False)
end sub
问题有两个:
- 这是一个 libreoffice 宏,因此它也可以与Calc和Base一起运行,我想避免在Calc和Base中出现错误消息;
- 使用此宏,光标将转到书签,但是Writer的 focus 不在光标上:我宁愿避免这种情况,而是将重点放在光标上.
- this is a libreoffice macro, and so it runs also with Calc and Base, and I'd like to avoid error messages in Calc and Base;
- With this macro the cursor go to the bookmark, but the focus of Writer is not on the cursor: I prefer to avoid this situation and have focus on cursor.
谢谢
推荐答案
正如您在 LibreOffice论坛 ***:
- 如果没有Writer文档,请避免调用宏
-
检查文档类型
- avoid calling the macro, if you don't have a Writer document
check for the document type
If NOT ThisComponent.supportsService("com.sun.star.text.TextDocument" ) Then
Exit Sub
End If
检查书签是否存在
check for bookmarks existence
oBookmarks = ThisComponent.getBookmarks()
If NOT oBookmarks.hasByName("qui") Then
***交叉张贴问题而未参考您寻求帮助的其他论坛,这是冒犯他们的空闲时间来帮助他们的志愿者的行为.
*** Cross-posting a question without any reference to other forums you asked for help is offending to the volunteers who spend their free time to help.
这篇关于微调goto书签libreoffice宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!