Aspose::Words::Saving::SaveOptions::CreateSaveOptions method

SaveOptions::CreateSaveOptions(Aspose::Words::SaveFormat) method

Creates a save options object of a class suitable for the specified save format.

static System::SharedPtr<Aspose::Words::Saving::SaveOptions> Aspose::Words::Saving::SaveOptions::CreateSaveOptions(Aspose::Words::SaveFormat saveFormat)
ParameterTypeDescription
saveFormatAspose::Words::SaveFormatThe save format for which to create a save options object.

ReturnValue

An object of a class that derives from SaveOptions.

See Also

SaveOptions::CreateSaveOptions(const System::String&) method

Creates a save options object of a class suitable for the file extension specified in the given file name.

static System::SharedPtr<Aspose::Words::Saving::SaveOptions> Aspose::Words::Saving::SaveOptions::CreateSaveOptions(const System::String &fileName)
ParameterTypeDescription
fileNameconst System::String&The extension of this file name determines the class of the save options object to create.

ReturnValue

An object of a class that derives from SaveOptions.

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