Underlining and bolding text

元气小坏坏 提交于 2020-01-13 09:48:25

问题


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());

回答1:


Try to set Underline Val property to Single like this:

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


来源:https://stackoverflow.com/questions/13828984/underlining-and-bolding-text

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!