I'd like to know how I can modify the font setting of default Heading styles.
Thank you.
I'd like to know how I can modify the font setting of default Heading styles.
Thank you.
Hi there,
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”>Document doc = new
Document();<o:p></o:p>
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
color:blue;mso-fareast-language:EN-GB”>foreach<span style=“font-size:
10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”> (Style style in
doc.Styles)<o:p></o:p>
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”>{<o:p></o:p>
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”> if (style.Font != null)<o:p></o:p>
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”> {<o:p></o:p>
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”>
style.Font.ClearFormatting();<o:p></o:p>
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”>
style.Font.Size = 20;<o:p></o:p>
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”>
style.Font.Name = “Arial”;<o:p></o:p>
<span style=“font-size:10.0pt;font-family:“Courier New”;mso-fareast-font-family:“Times New Roman”;
mso-fareast-language:EN-GB”> }<o:p></o:p>
}
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Style style = doc.Styles[StyleIdentifier.Heading1];
style.Font.ClearFormatting();
style.Font.Size = 15;
style.Font.Color = Color.Blue;
style.Font.Name = "Arial";
builder.ParagraphFormat.Style = style;
builder.Writeln("Hello World");
doc.Save(MyDir + "out.docx");
That worked great. Thank you.
Hi there,