7

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());
Deduplicator
  • 44,692
  • 7
  • 66
  • 118
AustinT
  • 1,998
  • 8
  • 40
  • 63
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Dec 11 '12 at 21:49

1 Answers1

19

Try to set Underline Val property to Single like this:

new Underline() { Val = DocumentFormat.OpenXml.Wordprocessing.UnderlineValues.Single }
RAS
  • 3,375
  • 15
  • 24