【问题标题】:Aspose.Words - Format a single word in a paragraphAspose.Words - 格式化段落中的单个单词
【发布时间】:2017-03-31 21:26:18
【问题描述】:

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

【问题讨论】:

    标签: ms-word aspose.words


    【解决方案1】:

    我一直在努力,并通过使用 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.");
    

    【讨论】:

      猜你喜欢
      • 2020-08-18
      • 1970-01-01
      • 2022-10-15
      • 1970-01-01
      • 2013-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多