Class SaveOptions

Class SaveOptions

Namespace: Aspose.Words.Saving
Assembly: Aspose.Words.dll (25.3.0)

This is an abstract base class for classes that allow the user to specify additional options when saving a document into a particular format.

To learn more, visit the Specify Save Options documentation article.

public abstract class SaveOptions

Inheritance

objectSaveOptions

Derived

DocSaveOptions, FixedPageSaveOptions, HtmlSaveOptions, OdtSaveOptions, OoxmlSaveOptions, RtfSaveOptions, TxtSaveOptionsBase, WordML2003SaveOptions, XamlFlowSaveOptions, XlsxSaveOptions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Remarks

An instance of the Aspose.Words.Saving.SaveOptions class or any derived class is passed to the stream Aspose.Words.Document.Save(System.IO.Stream,Aspose.Words.Saving.SaveOptions) or string Aspose.Words.Document.Save(System.String,Aspose.Words.Saving.SaveOptions) overloads for the user to define custom options when saving a document.

Constructors

SaveOptions()

protected SaveOptions()

Properties

AllowEmbeddingPostScriptFonts

Gets or sets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved. The default value is false.

public bool AllowEmbeddingPostScriptFonts { get; set; }

Property Value

bool

Remarks

Note, Word does not embed PostScript fonts, but can open documents with embedded fonts of this type.

This option only works when Aspose.Words.Fonts.FontInfoCollection.EmbedTrueTypeFonts of the Aspose.Words.DocumentBase.FontInfos property is set to true.

CustomTimeZoneInfo

Gets or sets custom local time zone used for date/time fields.

public TimeZoneInfo CustomTimeZoneInfo { get; set; }

Property Value

TimeZoneInfo

Remarks

This option is available in either .Net framework starting from 3.5 version or .Net Standard.

By default, Aspose.Words uses system local time zone when writes date/time fields, this option allows to set custom value.

DefaultTemplate

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

public string DefaultTemplate { get; set; }

Property Value

string

Remarks

If specified, this path is used to load template when Aspose.Words.Document.AutomaticallyUpdateStyles is true, but Aspose.Words.Document.AttachedTemplate is empty.

Dml3DEffectsRenderingMode

Gets or sets a value determining how 3D effects are rendered.

public Dml3DEffectsRenderingMode Dml3DEffectsRenderingMode { get; set; }

Property Value

Dml3DEffectsRenderingMode

Remarks

The default value is Aspose.Words.Saving.Dml3DEffectsRenderingMode.Basic.

DmlEffectsRenderingMode

Gets or sets a value determining how DrawingML effects are rendered.

public virtual DmlEffectsRenderingMode DmlEffectsRenderingMode { get; set; }

Property Value

DmlEffectsRenderingMode

Remarks

The default value is Aspose.Words.Saving.DmlEffectsRenderingMode.Simplified.

This property is used when the document is exported to fixed page formats.

DmlRenderingMode

Gets or sets a value determining how DrawingML shapes are rendered.

public DmlRenderingMode DmlRenderingMode { get; set; }

Property Value

DmlRenderingMode

Remarks

The default value is Aspose.Words.Saving.DmlRenderingMode.Fallback.

This property is used when the document is exported to fixed page formats.

ExportGeneratorName

When true, causes the name and version of Aspose.Words to be embedded into produced files. Default value is true.

public bool ExportGeneratorName { get; set; }

Property Value

bool

ImlRenderingMode

Gets or sets a value determining how ink (InkML) objects are rendered.

public ImlRenderingMode ImlRenderingMode { get; set; }

Property Value

ImlRenderingMode

Remarks

The default value is Aspose.Words.Saving.ImlRenderingMode.InkML.

This property is used when the document is exported to fixed page formats.

MemoryOptimization

Gets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false.

public bool MemoryOptimization { get; set; }

Property Value

bool

Remarks

Setting this option to true can significantly decrease memory consumption while saving large documents at the cost of slower saving time.

PrettyFormat

When true, pretty formats output where applicable. Default value is false.

public bool PrettyFormat { get; set; }

Property Value

bool

Remarks

Set to true to make HTML, MHTML, EPUB, WordML, RTF, DOCX and ODT output human readable. Useful for testing or debugging.

ProgressCallback

Called during saving a document and accepts data about saving progress.

public IDocumentSavingCallback ProgressCallback { get; set; }

Property Value

IDocumentSavingCallback

Remarks

Progress is reported when saving to Aspose.Words.SaveFormat.Docx, Aspose.Words.SaveFormat.FlatOpc, Aspose.Words.SaveFormat.Docm, Aspose.Words.SaveFormat.Dotm, Aspose.Words.SaveFormat.Dotx, Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveFormat.Dot, Aspose.Words.SaveFormat.Html, Aspose.Words.SaveFormat.Mhtml, Aspose.Words.SaveFormat.Epub, Aspose.Words.SaveFormat.XamlFlow, or Aspose.Words.SaveFormat.XamlFlowPack.

SaveFormat

Specifies the format in which the document will be saved if this save options object is used.

public abstract SaveFormat SaveFormat { get; set; }

Property Value

SaveFormat

TempFolder

Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default this property is null and no temporary files are used.

public string TempFolder { get; set; }

Property Value

string

Remarks

When Aspose.Words saves a document, it needs to create temporary internal structures. By default, these internal structures are created in memory and the memory usage spikes for a short period while the document is being saved. When saving is complete, the memory is freed and reclaimed by the garbage collector.

Specifying a temporary folder using Aspose.Words.Saving.SaveOptions.TempFolder will cause Aspose.Words to keep the internal structures in temporary files instead of memory. It reduces the memory usage during saving, but will decrease the save performance.

The folder must exist and be writable, otherwise an exception will be thrown.

Aspose.Words automatically deletes all temporary files when saving is complete.

Exceptions

OutOfMemoryException

Throw if you are saving a very large document (thousands of pages) and/or processing many documents at the same time. The memory spike during saving can be significant enough to cause the exception.

UpdateAmbiguousTextFont

Determines whether the font attributes will be changed according to the character code being used.

public bool UpdateAmbiguousTextFont { get; set; }

Property Value

bool

UpdateCreatedTimeProperty

Gets or sets a value determining whether the Aspose.Words.Properties.BuiltInDocumentProperties.CreatedTime property is updated before saving. Default value is false;

public bool UpdateCreatedTimeProperty { get; set; }

Property Value

bool

UpdateFields

Gets or sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true.

public bool UpdateFields { get; set; }

Property Value

bool

Remarks

Allows to specify whether to mimic or not MS Word behavior.

UpdateLastPrintedProperty

Gets or sets a value determining whether the Aspose.Words.Properties.BuiltInDocumentProperties.LastPrinted property is updated before saving.

public bool UpdateLastPrintedProperty { get; set; }

Property Value

bool

UpdateLastSavedTimeProperty

Gets or sets a value determining whether the Aspose.Words.Properties.BuiltInDocumentProperties.LastSavedTime property is updated before saving.

public bool UpdateLastSavedTimeProperty { get; set; }

Property Value

bool

UseAntiAliasing

Gets or sets a value determining whether or not to use anti-aliasing for rendering.

public bool UseAntiAliasing { get; set; }

Property Value

bool

Remarks

The default value is false. When this value is set to true anti-aliasing is used for rendering.

This property is used when the document is exported to the following formats: Aspose.Words.SaveFormat.Tiff, Aspose.Words.SaveFormat.Png, Aspose.Words.SaveFormat.Bmp, Aspose.Words.SaveFormat.Jpeg, Aspose.Words.SaveFormat.Emf. When the document is exported to the Aspose.Words.SaveFormat.Html, Aspose.Words.SaveFormat.Mhtml, Aspose.Words.SaveFormat.Epub, Aspose.Words.SaveFormat.Azw3 or Aspose.Words.SaveFormat.Mobi formats this option is used for raster images.

UseHighQualityRendering

Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms.

public bool UseHighQualityRendering { get; set; }

Property Value

bool

Remarks

The default value is false.

This property is used when the document is exported to image formats: Aspose.Words.SaveFormat.Tiff, Aspose.Words.SaveFormat.Png, Aspose.Words.SaveFormat.Bmp, Aspose.Words.SaveFormat.Jpeg, Aspose.Words.SaveFormat.Emf.

Methods

CreateSaveOptions(SaveFormat)

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

public static SaveOptions CreateSaveOptions(SaveFormat saveFormat)

Parameters

saveFormat SaveFormat

The save format for which to create a save options object.

Returns

SaveOptions

An object of a class that derives from Aspose.Words.Saving.SaveOptions.

CreateSaveOptions(string)

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

public static SaveOptions CreateSaveOptions(string fileName)

Parameters

fileName string

The extension of this file name determines the class of the save options object to create.

Returns

SaveOptions

An object of a class that derives from Aspose.Words.Saving.SaveOptions.

 English