SaveOptionsCreateSaveOptions(String) Method

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.10.0

ExpandedSyntax

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.

ExpandedExamples

Shows how to set a default template for documents that do not have attached templates.
Document doc = new Document();

// Enable automatic style updating, but do not attach a template document.
doc.AutomaticallyUpdateStyles = true;

Assert.AreEqual(string.Empty, doc.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.
SaveOptions options = SaveOptions.CreateSaveOptions("Document.DefaultTemplate.docx");
options.DefaultTemplate = MyDir + "Business brochure.dotx";

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

ExpandedSee Also