DefaultParagraphFormat
Contents
[
Hide
]StyleCollection.DefaultParagraphFormat property
Gets document default paragraph formatting.
public ParagraphFormat DefaultParagraphFormat { get; }
Remarks
Note that document-wide defaults were introduced in Microsoft Word 2007 and are fully supported in OOXML formats (Docx) only. Earlier document formats have no support for document default paragraph formatting.
Examples
Shows how to add a Style to a document’s styles collection.
Document doc = new Document();
StyleCollection styles = doc.Styles;
// Set default parameters for new styles that we may later add to this collection.
styles.DefaultFont.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.DefaultParagraphFormat.FirstLineIndent = 15.0;
// Add a style, and then verify that it has the default settings.
styles.Add(StyleType.Paragraph, "MyStyle");
Assert.AreEqual("Courier New", styles[4].Font.Name);
Assert.AreEqual(15.0, styles["MyStyle"].ParagraphFormat.FirstLineIndent);
See Also
- class ParagraphFormat
- class StyleCollection
- namespace Aspose.Words
- assembly Aspose.Words