下划线和粗体文本 [英] Underlining and bolding text

查看:132
本文介绍了下划线和粗体文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使文本带有下划线和粗体?我的文字变粗体,但没有下划线.
这是我的一些代码,使用运行属性将给定文本加粗并加下划线很简单.

how do I get the text to be underlined and bold? My text gets bold but does not get underlined.
Here is some of my code, which is pretty straight forward uses run properties to bold and underline the given text.

Run run_header = para_main.AppendChild(new Run());
RunProperties runProps = new RunProperties();
Bold bold = new Bold();
Underline ul = new Underline();
runProps.Append(bold);
runProps.Append(ul);
run_header.AppendChild(new RunProperties(runProps));
//run_header.AppendChild(new RunProperties(new Bold(), new Underline()));

string username = form.Username;
string proces_header = form.HeaderTitle;

run_header.AppendChild(new Text(proces_header + " | " + username));
run_header.AppendChild(new Break());

推荐答案

尝试将Underval Val属性设置为Single,如下所示:

Try to set Underline Val property to Single like this:

new Underline() { Val = DocumentFormat.OpenXml.Wordprocessing.UnderlineValues.Single }

这篇关于下划线和粗体文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆