当我将样式应用于段落时,VSTO如何保留数字格式
我想更改段落的样式,并保留
开始的数字格式,例如图片:
entry Image Description <此处< /a>
我写下代码以更改示例的样式:
wdapp.Selection.Range.Paragraphs.Style = wdapp.ActiveDocument.Styles(Word.WdBuiltinStyle.wdStyleHeading1)
但是数字格式将被清除(请参见图片示例A) 在此处输入图像描述
当我更改样式时,我该如何保持数字格式?
示例B是我想要的结果(请参阅图片)在此处解决图像描述
以解决Problme,我尝试使用“ ListFormat”恢复,但无用
Dim bh = wdapp.Selection.Range.ListFormat.ListTemplate
wdapp.Selection.Range.Paragraphs.Style = wdapp.ActiveDocument.Styles(Word.WdBuiltinStyle.wdStyleHeading1)
wdapp.Selection.Range.ListFormat.ApplyListTemplate(ListTemplate:=bh)
I want to change the style of paragraphs, and keep the Number Format
For begin like picture:
I write the code below to change style of Example A:
wdapp.Selection.Range.Paragraphs.Style = wdapp.ActiveDocument.Styles(Word.WdBuiltinStyle.wdStyleHeading1)
But the Number Format will be cleard (see picture Example A)
enter image description here
How can I do to keep the Number Format when I change style?
the example B is result what I want (see picture)enter image description here
In order to resolve problme, I try to use "ListFormat" to recover but useless
Dim bh = wdapp.Selection.Range.ListFormat.ListTemplate
wdapp.Selection.Range.Paragraphs.Style = wdapp.ActiveDocument.Styles(Word.WdBuiltinStyle.wdStyleHeading1)
wdapp.Selection.Range.ListFormat.ApplyListTemplate(ListTemplate:=bh)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论