【发布时间】:2017-06-07 06:58:49
【问题描述】:
我需要使用 OpenXML 为段落添加样式。我有以下代码,它正在运行,但样式不是我要添加的样式。
var file = WordprocessingDocument.Open(fileName, true);
var text = new Text("Hello world");
var run = new Run(text);
var paragraph = new Paragraph(run);
paragraph.ParagraphProperties = new ParagraphProperties(
new ParagraphStyleId() { Val = "Body Text" });
file.MainDocumentPart.Document.Body.AppendChild(paragraph);
file.MainDocumentPart.Document.Save();
有什么我做错了吗??? 如何使用 OpenXML 将一些现有样式添加到段落中。
【问题讨论】:
标签: .net ms-word openxml paragraph