default_font property
StyleCollection.default_font property
Gets document default text formatting.
@property
def default_font(self) -> aspose.words.Font:
...
Remarks
Note that document-wide defaults were introduced in Microsoft Word 2007 and are fully supported in OOXML formats (LoadFormat.DOCX) only. Earlier document formats have limited support for this feature and only font names can be stored.
Examples
Shows how to add a Style to a document’s styles collection.
doc = aw.Document()
styles = doc.styles
# Set default parameters for new styles that we may later add to this collection.
styles.default_font.name = 'Courier New'
# If we add a style of the "StyleType.Paragraph", the collection will apply the values of
# its "DefaultParagraphFormat" property to the style's "ParagraphFormat" property.
styles.default_paragraph_format.first_line_indent = 15
# Add a style, and then verify that it has the default settings.
styles.add(aw.StyleType.PARAGRAPH, 'MyStyle')
self.assertEqual('Courier New', styles[4].font.name)
self.assertEqual(15, styles.get_by_name('MyStyle').paragraph_format.first_line_indent)
See Also
- module aspose.words
- class StyleCollection