SaveOptionsCreateSaveOptions Method (String)

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

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public static SaveOptions CreateSaveOptions(
	string fileName
)

Parameters

fileName
Type: SystemString
The extension of this file name determines the class of the save options object to create.

Return Value

Type: SaveOptions
An object of a class that derives from SaveOptions.
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.AutomaticallyUpdateStyles = 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 + "Busniess brochure.dotx";

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