简体   繁体   English

MigraDoc - 在段落中加粗某些文本

[英]MigraDoc - Bold certain text in a paragraph

In MigraDoc, if I have a paragraph, how can I only bold some text in the paragraph, not the entire paragraph. 在MigraDoc中,如果我有一个段落,我怎么才能在段落中加粗一些文字,而不是整个段落。

Edit: Below is the typical code I would use to add a bolded paragraph. 编辑:下面是我用来添加粗体段落的典型代码。

var paragraph = section.AddParagraph("This text");
paragraph.Format.Font.Bold = true;

I can't just add separate paragraphs splitting the text, because MigraDoc puts space between the paragraphs. 我不能只添加拆分文本的单独段落,因为MigraDoc在段落之间放置了空格。

Try the following lines: 请尝试以下行:

var paragraph = section.AddParagraph("This text"); 

paragraph.AddFormattedText("Text in Bold Style", TextFormat.Bold); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM