Aspose::Words::Saving::SaveOptions::get_DefaultTemplate method

SaveOptions::get_DefaultTemplate method

Gets or sets path to default template (including filename). Default value for this property is empty string.

System::String Aspose::Words::Saving::SaveOptions::get_DefaultTemplate() const

Examples

Shows how to set a default template for documents that do not have attached templates.

auto doc = System::MakeObject<Aspose::Words::Document>();

// Enable automatic style updating, but do not attach a template document.
doc->set_AutomaticallyUpdateStyles(true);

ASSERT_EQ(System::String::Empty, doc->get_AttachedTemplate());

// 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.
System::SharedPtr<Aspose::Words::Saving::SaveOptions> options = Aspose::Words::Saving::SaveOptions::CreateSaveOptions(u"Document.DefaultTemplate.docx");
options->set_DefaultTemplate(get_MyDir() + u"Business brochure.dotx");

doc->Save(get_ArtifactsDir() + u"Document.DefaultTemplate.docx", options);

See Also