使用 Novacode 的 DocX,我可以像这样添加一个带有标题 1 样式的段落:
但我无法添加“标题”样式:
var p = docX.InsertParagraph("My Heading");
p.StyleName = "Heading1";
但我无法添加“标题”样式:
var p = docX.InsertParagraph("My Heading");
p.StyleName = "Title";
我查看了生成的Xml文件,发现“标题”样式不在Styles.xml文件中,但是如果我在Word中将其设置为标题样式并保存,则标题样式会出现在styles Xml文件中。
那么我该如何让DocX包含标题样式,或者如何添加一个样式到DocX样式中呢?