DocumentAutomaticallyUpdateSyles 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: 19.9
public bool AutomaticallyUpdateSyles { get; set; }

Property Value

Type: Boolean
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 + "Document.BusinessBrochureTemplate.dotx";


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

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