DocumentAutomaticallyUpdateStyles Property

Gets or sets a flag indicating whether the styles in the document are updated to match the styles in the attached template each time the document is opened in MS Word.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public bool AutomaticallyUpdateStyles { get; set; }

Property Value

Type: Boolean
Examples
Shows how to update a document's styles based on its template.
Document doc = new Document();

// Empty Microsoft Word documents by default come with an attached template called "Normal.dotm"
// There is no default template for Aspose Words documents
Assert.AreEqual(string.Empty, doc.AttachedTemplate);

// For AutomaticallyUpdateStyles to have any effect, we need a document with a template
// We can make a document with word and open it
// Or we can attach a template from our file system, as below
doc.AttachedTemplate = MyDir + "Busniess brochure.dotx";

Assert.IsTrue(doc.AttachedTemplate.EndsWith("Busniess brochure.dotx"));

// Any changes to the styles in this template will be propagated to those styles in the document
doc.AutomaticallyUpdateStyles = true;

doc.Save(ArtifactsDir + "Document.AutomaticallyUpdateStyles.docx");
See Also