【发布时间】:2017-09-17 00:40:24
【问题描述】:
我想让一些文字像这样加粗.. • 基本 - 没有网络安全
【问题讨论】:
标签: c# docx novacode-docx
我想让一些文字像这样加粗.. • 基本 - 没有网络安全
【问题讨论】:
标签: c# docx novacode-docx
这样做的一种方法是将粗体文本分别插入到同一段落中。
// Create the proper formats first
Formatting bold = new Formatting();
bold.Bold = true;
Formatting notBold = new Formatting();
// Create the file
DocX doc = DocX.Create("test.docx");
// Insert the text you want with the proper formatting for each section
Paragraph para = doc.InsertParagraph();
para.InsertText("not bold text ", false, notBold);
para.InsertText("bold text ", false, bold);
para.InsertText("not bold text", false, notBold);
doc.Save();
这将输出:
非粗体文本粗体文本非粗体文本
【讨论】: