How to modify default styles?

I’d like to know how I can modify the font setting of default Heading styles.
Thank you.

Hi there,

Thanks for your inquiry. Following code snippets shows how to change the font formatting of styles in a document. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document();
foreach(Style style in doc.Styles)
{
    if (style.Font != null)
    {

        style.Font.ClearFormatting();

        style.Font.Size = 20;

        style.Font.Name = "Arial";
    }
}
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,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.