Aspose.Words - 格式化段落中的单个单词

时间:2017-03-31 21:26:18

标签: ms-word aspose.words

我是Aspose.Words for .Net的新手,并致力于为客户重新创建一些文档。我需要在一个粗体和下划线的段落中单个单词。我试图通过在粗体词,粗体词本身和之后的文本之前为文本创建单独的段落运行来实现此目的。然后我格式化粗体字的运行并将所有内容附加到段落中。这似乎过于复杂。有没有一种简单的方法可以在DocumentBuilder.WriteLn中实现这一点("一些文字")?

1 个答案:

答案 0 :(得分:0)

我一直在努力,通过使用DocumentBuilder.Write()而不是DocumentBuilder.Writeln()实现了预期的结果:

builder.Write("The start of the paragraph ");
builder.Font.Bold = true;
builder.Font.Underline = Underline.Single;
builder.Write("underlined bolded text");
builder.Font.Bold = false;
builder.Font.Underline = Underline.None;
builder.Write(" the end of the paragraph.");
相关问题