0

我想让一些文本像这样加粗。 • 基本- 没有网络安全

4

1 回答 1

0

这样做的一种方法是将粗体文本分别插入到同一段落中。

// 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();

这将输出:

非粗体文本粗体文本非粗体文本

于 2018-03-13T17:37:12.507 回答