DocumentAttachedTemplate Property
Gets or sets the full path of the template attached to the document.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public string AttachedTemplate { get; set; }

Property Value

Type: String
Exceptions
ExceptionCondition
ArgumentNullExceptionThrows if you attempt to set to a null value.
Remarks

Empty string means the document is attached to the Normal template.

Examples
Shows how to set a default .docx document template.
Document doc = new Document();

// If we set this flag to true while not having a template attached to the document,
// there will be no effect because there is no template document to draw style changes from
doc.AutomaticallyUpdateSyles = true;
Assert.That(doc.AttachedTemplate, Is.Empty);

// We can set a default template document filename in a SaveOptions object to make it apply to
// all documents we save with it that have no AttachedTemplate value
SaveOptions options = SaveOptions.CreateSaveOptions("Document.DefaultTemplate.docx");
options.DefaultTemplate = MyDir + "Document.BusinessBrochureTemplate.dotx";

doc.Save(ArtifactsDir + "Document.DefaultTemplate.docx", options);
See Also