将BOLD设置为Gembox文档ASP.NET C#中的段落
我在我的asp.net页面中使用gembox.document库。我有一个包含线路断裂的段落,我还需要将段落设置为粗体。 我的下面代码可变str包含换行字符。
尝试1 线路断裂在以下代码中运行良好 var p3 =新段落(WDOC,str);
如何对本段设置大胆
尝试2 大胆在以下代码中效果很好,
var p3 = new Paragraph(wDoc,
new Run(wDoc, str) { CharacterFormat = { Bold = true } }
);
这不允许划线,
请帮助解决方案
I am using GemBox.Document library in my ASP.Net Page. I have a paragraph which contains line breaks and I also need to set the paragraph to bold.
I my below code the variable str contains line break characters.
TRY 1
Line breaks work well in the below codevar p3 = new Paragraph(wDoc, str);
How to set BOLD to this paragraph
TRY 2
Bold work well in the below code
var p3 = new Paragraph(wDoc,
new Run(wDoc, str) { CharacterFormat = { Bold = true } }
);
This doesn't allow line breaks
Please help for a solution
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能是这样最简单的方法是这样的:
或这样:
但是,以防万一您有兴趣,这里要注意的是,line breaks用
special> specialcharacter
对象表示,而不是运行
对象。因此,以下是您需要自己处理这些休息时间的“手动”方式,您需要将正确的元素添加到
段段
。正在使用此
段
构造函数:Probably the easiest way to do this is something like this:
Or this:
But just in case you're interested, the thing to note here is that line breaks are represented with
SpecialCharacter
objects, not withRun
objects.So the following would be the "manual" way in which you would need to handle those breaks yourself, you would need to add the correct elements to the
Paragraph.Inlines
collection:That is the same as if you were using this
Paragraph
constructor: