Word - 在现有书签之间或文档末尾添加书签
我有一个应用程序,我需要能够在当前书签末尾插入 ContentControl。换句话说,当用户单击工具栏上的按钮时,应用程序应识别哪个书签(如果有)包含 application.selection.range.start 移动到书签的末尾,插入 ContentControl 并为新控件添加书签。
似乎无论我尝试什么,新的内容控件都会插入到现有书签中 - 或者 - 如果我将 range.start 设置为 range.end+1,我会收到越界异常。
当您考虑这一点时,请记住可能有 bookmarks.count == 0 或者书签可能位于文档的最后,因此 bmk.range.end +1 超出了文档的末尾。
提前致谢, 艾迪
I have an application where I need to be able to insert a ContentControl after the end of the current bookmark. In other words when the user clicks a button on the toolbar, the app should identify what bookmark (if any) contains the application.selection.range.start move to the end of the bookmark, insert a ContentControl and bookmark the new control.
It seems no matter what I try, the new content control is inserted into the existing bookmark -or- if I set the range.start to range.end+1 I receive an out of bounds exception.
As you consider this, bear in mind that there may be bookmarks.count == 0 or the bookmark may be at the very end of the document so bmk.range.end +1 is past the end of the document.
Thanks in advance,
Eddie
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论