attached_template property
Document.attached_template property
Gets or sets the full path of the template attached to the document.
@property
def attached_template(self) -> str:
...
@attached_template.setter
def attached_template(self, value: str):
...
Exceptions
exception | condition |
---|---|
RuntimeError (Proxy error(ArgumentNullException)) | Throws if you attempt to set to a None value. |
Remarks
Empty string means the document is attached to the Normal template.
Examples
Shows how to set a default template for documents that do not have attached templates.
doc = aw.Document()
# Enable automatic style updating, but do not attach a template document.
doc.automatically_update_styles = True
self.assertEqual("", doc.attached_template)
# Since there is no template document, the document had nowhere to track style changes.
# Use a SaveOptions object to automatically set a template
# if a document that we are saving does not have one.
options = aw.saving.SaveOptions.create_save_options("Document.default_template.docx")
options.default_template = MY_DIR + "Business brochure.dotx"
doc.save(ARTIFACTS_DIR + "Document.default_template.docx", options)
See Also
- module aspose.words
- class Document
- property BuiltInDocumentProperties.template