GemBox Support Forum

How to set font family to Arial with HtmlLoadOptions()

Currently am using below code to get my value in html format:

    new HtmlLoadOptions() { InheritCharacterFormat = true,InheritParagraphFormat=true });

How to set the font family to Arial to above HtmlLoadOptions.

Any help on this would be great.


You can specify the Arial font in your HTML content.
For example, you could add something like this to your sowTemplateField.value content:

* { font-family: Arial; }

Or you can iterate through Run elements inside the content control after loading the HTML content.
For example, like this:

foreach (Run run in contentControl.GetChildElements(true, ElementType.Run))
    run.CharacterFormat.FontName = "Arial";

I hope this helps.