如何选择从特定书签开始到文档末尾的文本? [英] How to select text starting from a specific bookmark to the end of a document?

查看:87
本文介绍了如何选择从特定书签开始到文档末尾的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我们的用户希望通过按功能区菜单中的按钮重新格式化所有文档段落。但是,他们希望仅从文档主体开始。不应重新格式化标题第一页和后续文档内容页面。  

Our users would like to reformat all document paragraphs by pressing a button in the ribbon menu. However, they would like to do it starting from a document body only. The title first page and following document content pages should not be reformatted.  

想法是选择从特定书签开始到文档结尾的文档文本并应用段落格式规则选择。我创建了一个文档正文开始的书签。书签以相同的位置开始和结束。问题
是我不知道如何从该书签开始以编程方式选择剩余的文本。宏录制仅生成重新格式化代码的段落。选项代码本身不会被记录。

The idea is to select document text starting from a certain bookmark to the document end and apply paragraph formatting rules to the selection. I created a bookmark where the document body starts. The bookmark starts and ends in the same position. The problem is I do not know how to select programmatically remaining text starting from this bookmark. The macro recording generates paragraphs reformatting code only. The selection code itself is not recorded.

为了您的信息,该文档是文档级VSTO C#自定义Word 2016模板。

For your information, the document is a document level VSTO C# customized Word 2016 template.

有人可以帮忙吗?

谢谢

推荐答案

段落重新格式化应通过应用适当的段落样式来完成。如果您恰当地设计了样式,那么实现所需的格式就像选择相关范围并选择相关样式一样简单。无需代码。

Paragraph reformatting should be done via the application of appropriate paragraph Styles. If you design the Styles appropriately, achieving the desired formats is as simple as selecting the range concerned and choosing the relevant Style. No code required.

如果以编程方式生成文档,只需设置一个范围对象,例如,从第二页到文档末尾,并应用所需的样式。更好的是,在将文本添加到
之前将样式应用于当前段落,并且该段落和任何后续段落将获得相同的样式,直到您更改为其他样式。

If the document is being generated programmatically, simply set a range object that spans from, say, the second page to the end of the document and apply the required Style. Better still, apply the Style to the current paragraph before adding text to it and both that paragraph and any subsequent paragraphs will acquire the same Style until you change to a different Style.


这篇关于如何选择从特定书签开始到文档末尾的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆