SaveOptions

Inheritance: java.lang.Object

public abstract class SaveOptions

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.

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

Methods

Method Description
createSaveOptions(int saveFormat)
createSaveOptions(String fileName) Creates a save options object of a class suitable for the file extension specified in the given file name.
equals(Object arg0)
getAllowEmbeddingPostScriptFonts() Gets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved.
getClass()
getDefaultTemplate() Gets path to default template (including filename).
getDml3DEffectsRenderingMode() Gets a value determining how 3D effects are rendered.
getDmlEffectsRenderingMode() Gets a value determining how DrawingML effects are rendered.
getDmlRenderingMode() Gets a value determining how DrawingML shapes are rendered.
getExportGeneratorName() When true , causes the name and version of Aspose.Words to be embedded into produced files.
getImlRenderingMode() Gets a value determining how ink (InkML) objects are rendered.
getMemoryOptimization() Gets value determining if memory optimization should be performed before saving the document.
getPrettyFormat() When true , pretty formats output where applicable.
getProgressCallback() Called during saving a document and accepts data about saving progress.
getSaveFormat() Specifies the format in which the document will be saved if this save options object is used.
getTempFolder() Specifies the folder for temporary files used when saving to a DOC or DOCX file.
getUpdateCreatedTimeProperty() Gets a value determining whether the BuiltInDocumentProperties.getCreatedTime() / BuiltInDocumentProperties.setCreatedTime(java.util.Date) property is updated before saving.
getUpdateFields() Gets a value determining if fields of certain types should be updated before saving the document to a fixed page format.
getUpdateLastPrintedProperty() Gets a value determining whether the BuiltInDocumentProperties.getLastPrinted() / BuiltInDocumentProperties.setLastPrinted(java.util.Date) property is updated before saving.
getUpdateLastSavedTimeProperty() Gets a value determining whether the BuiltInDocumentProperties.getLastSavedTime() / BuiltInDocumentProperties.setLastSavedTime(java.util.Date) property is updated before saving.
getUpdateSdtContent() Gets value determining whether content of StructuredDocumentTag is updated before saving.
getUseAntiAliasing() Gets a value determining whether or not to use anti-aliasing for rendering.
getUseHighQualityRendering() Gets a value determining whether or not to use high quality (i.e.
hashCode()
notify()
notifyAll()
setAllowEmbeddingPostScriptFonts(boolean value) Sets a boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved.
setDefaultTemplate(String value) Sets path to default template (including filename).
setDml3DEffectsRenderingMode(int value) Sets a value determining how 3D effects are rendered.
setDmlEffectsRenderingMode(int value) Sets a value determining how DrawingML effects are rendered.
setDmlRenderingMode(int value) Sets a value determining how DrawingML shapes are rendered.
setExportGeneratorName(boolean value) When true , causes the name and version of Aspose.Words to be embedded into produced files.
setImlRenderingMode(int value) Sets a value determining how ink (InkML) objects are rendered.
setMemoryOptimization(boolean value) Sets value determining if memory optimization should be performed before saving the document.
setPrettyFormat(boolean value) When true , pretty formats output where applicable.
setProgressCallback(IDocumentSavingCallback value) Called during saving a document and accepts data about saving progress.
setSaveFormat(int value) Specifies the format in which the document will be saved if this save options object is used.
setTempFolder(String value) Specifies the folder for temporary files used when saving to a DOC or DOCX file.
setUpdateCreatedTimeProperty(boolean value) Sets a value determining whether the BuiltInDocumentProperties.getCreatedTime() / BuiltInDocumentProperties.setCreatedTime(java.util.Date) property is updated before saving.
setUpdateFields(boolean value) Sets a value determining if fields of certain types should be updated before saving the document to a fixed page format.
setUpdateLastPrintedProperty(boolean value) Sets a value determining whether the BuiltInDocumentProperties.getLastPrinted() / BuiltInDocumentProperties.setLastPrinted(java.util.Date) property is updated before saving.
setUpdateLastSavedTimeProperty(boolean value) Sets a value determining whether the BuiltInDocumentProperties.getLastSavedTime() / BuiltInDocumentProperties.setLastSavedTime(java.util.Date) property is updated before saving.
setUpdateSdtContent(boolean value) Sets value determining whether content of StructuredDocumentTag is updated before saving.
setUseAntiAliasing(boolean value) Sets a value determining whether or not to use anti-aliasing for rendering.
setUseHighQualityRendering(boolean value) Sets a value determining whether or not to use high quality (i.e.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

createSaveOptions(int saveFormat)

public static SaveOptions createSaveOptions(int saveFormat)

Parameters:

Parameter Type Description
saveFormat int

Returns: SaveOptions

createSaveOptions(String fileName)

public static SaveOptions createSaveOptions(String fileName)

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

Parameters:

Parameter Type Description
fileName java.lang.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 SaveOptions.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

Parameter Type Description
arg0 java.lang.Object

Returns: boolean

getAllowEmbeddingPostScriptFonts()

public boolean getAllowEmbeddingPostScriptFonts()

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

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

This option only works when FontInfoCollection.getEmbedTrueTypeFonts() / FontInfoCollection.setEmbedTrueTypeFonts(boolean) of the DocumentBase.getFontInfos() property is set to true .

Returns: boolean - A boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getDefaultTemplate()

public String getDefaultTemplate()

Gets path to default template (including filename). Default value for this property is empty string. If specified, this path is used to load template when Document.getAutomaticallyUpdateStyles() / Document.setAutomaticallyUpdateStyles(boolean) is true , but Document.getAttachedTemplate() / Document.setAttachedTemplate(java.lang.String) is empty.

Returns: java.lang.String - Path to default template (including filename).

getDml3DEffectsRenderingMode()

public int getDml3DEffectsRenderingMode()

Gets a value determining how 3D effects are rendered. The default value is Dml3DEffectsRenderingMode.BASIC.

Returns: int - A value determining how 3D effects are rendered. The returned value is one of Dml3DEffectsRenderingMode constants.

getDmlEffectsRenderingMode()

public int getDmlEffectsRenderingMode()

Gets a value determining how DrawingML effects are rendered. The default value is DmlEffectsRenderingMode.SIMPLIFIED.

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

Returns: int - A value determining how DrawingML effects are rendered. The returned value is one of DmlEffectsRenderingMode constants.

getDmlRenderingMode()

public int getDmlRenderingMode()

Gets a value determining how DrawingML shapes are rendered. The default value is DmlRenderingMode.FALLBACK.

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

Returns: int - A value determining how DrawingML shapes are rendered. The returned value is one of DmlRenderingMode constants.

getExportGeneratorName()

public boolean getExportGeneratorName()

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

Returns: boolean - The corresponding boolean value.

getImlRenderingMode()

public int getImlRenderingMode()

Gets a value determining how ink (InkML) objects are rendered. The default value is ImlRenderingMode.INK_ML.

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

Returns: int - A value determining how ink (InkML) objects are rendered. The returned value is one of ImlRenderingMode constants.

getMemoryOptimization()

public boolean getMemoryOptimization()

Gets value determining if memory optimization should be performed before saving the document. Default value for this property is false . Setting this option to true can significantly decrease memory consumption while saving large documents at the cost of slower saving time.

Returns: boolean - Value determining if memory optimization should be performed before saving the document.

getPrettyFormat()

public boolean getPrettyFormat()

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

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

Returns: boolean - The corresponding boolean value.

getProgressCallback()

public IDocumentSavingCallback getProgressCallback()

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

Progress is reported when saving to SaveFormat.DOCX, SaveFormat.FLAT_OPC, SaveFormat.DOCM, SaveFormat.DOTM, SaveFormat.DOTX, SaveFormat.HTML, SaveFormat.MHTML, SaveFormat.EPUB, SaveFormat.XAML_FLOW, or SaveFormat.XAML_FLOW_PACK.

Returns: IDocumentSavingCallback - The corresponding IDocumentSavingCallback value.

getSaveFormat()

public abstract int getSaveFormat()

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

Returns: int - The corresponding int value. The returned value is one of SaveFormat constants.

getTempFolder()

public String getTempFolder()

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.

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.

If you are saving a very large document (thousands of pages) and/or processing many documents at the same time, then the memory spike during saving can be significant enough to cause the system to throw java.lang.IndexOutOfBoundsException. Specifying a temporary folder using getTempFolder() / setTempFolder(java.lang.String) 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.

Returns: java.lang.String - The corresponding java.lang.String value.

getUpdateCreatedTimeProperty()

public boolean getUpdateCreatedTimeProperty()

Gets a value determining whether the BuiltInDocumentProperties.getCreatedTime() / BuiltInDocumentProperties.setCreatedTime(java.util.Date) property is updated before saving. Default value is false ;

Returns: boolean - A value determining whether the BuiltInDocumentProperties.getCreatedTime() / BuiltInDocumentProperties.setCreatedTime(java.util.Date) property is updated before saving.

getUpdateFields()

public boolean getUpdateFields()

Gets 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 . Allows to specify whether to mimic or not MS Word behavior.

Returns: boolean - A value determining if fields of certain types should be updated before saving the document to a fixed page format.

getUpdateLastPrintedProperty()

public boolean getUpdateLastPrintedProperty()

Gets a value determining whether the BuiltInDocumentProperties.getLastPrinted() / BuiltInDocumentProperties.setLastPrinted(java.util.Date) property is updated before saving.

Returns: boolean - A value determining whether the BuiltInDocumentProperties.getLastPrinted() / BuiltInDocumentProperties.setLastPrinted(java.util.Date) property is updated before saving.

getUpdateLastSavedTimeProperty()

public boolean getUpdateLastSavedTimeProperty()

Gets a value determining whether the BuiltInDocumentProperties.getLastSavedTime() / BuiltInDocumentProperties.setLastSavedTime(java.util.Date) property is updated before saving.

Returns: boolean - A value determining whether the BuiltInDocumentProperties.getLastSavedTime() / BuiltInDocumentProperties.setLastSavedTime(java.util.Date) property is updated before saving.

getUpdateSdtContent()

public boolean getUpdateSdtContent()

Gets value determining whether content of StructuredDocumentTag is updated before saving. The default value is false .

Returns: boolean - Value determining whether content of StructuredDocumentTag is updated before saving.

getUseAntiAliasing()

public boolean getUseAntiAliasing()

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

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: SaveFormat.TIFF, SaveFormat.PNG, SaveFormat.BMP, SaveFormat.JPEG, SaveFormat.EMF. When the document is exported to the SaveFormat.HTML, SaveFormat.MHTML, SaveFormat.EPUB, SaveFormat.AZW_3 or SaveFormat.MOBI formats this option is used for raster images.

Returns: boolean - A value determining whether or not to use anti-aliasing for rendering.

getUseHighQualityRendering()

public boolean getUseHighQualityRendering()

Gets a value determining whether or not to use high quality (i.e. slow) rendering algorithms. The default value is false .

This property is used when the document is exported to image formats: SaveFormat.TIFF, SaveFormat.PNG, SaveFormat.BMP, SaveFormat.JPEG, SaveFormat.EMF.

Returns: boolean - A value determining whether or not to use high quality (i.e.

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setAllowEmbeddingPostScriptFonts(boolean value)

public void setAllowEmbeddingPostScriptFonts(boolean value)

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 .

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

This option only works when FontInfoCollection.getEmbedTrueTypeFonts() / FontInfoCollection.setEmbedTrueTypeFonts(boolean) of the DocumentBase.getFontInfos() property is set to true .

Parameters:

Parameter Type Description
value boolean A boolean value indicating whether to allow embedding fonts with PostScript outlines when embedding TrueType fonts in a document upon it is saved.

setDefaultTemplate(String value)

public void setDefaultTemplate(String value)

Sets path to default template (including filename). Default value for this property is empty string. If specified, this path is used to load template when Document.getAutomaticallyUpdateStyles() / Document.setAutomaticallyUpdateStyles(boolean) is true , but Document.getAttachedTemplate() / Document.setAttachedTemplate(java.lang.String) is empty.

Parameters:

Parameter Type Description
value java.lang.String Path to default template (including filename).

setDml3DEffectsRenderingMode(int value)

public void setDml3DEffectsRenderingMode(int value)

Sets a value determining how 3D effects are rendered. The default value is Dml3DEffectsRenderingMode.BASIC.

Parameters:

Parameter Type Description
value int A value determining how 3D effects are rendered. The value must be one of Dml3DEffectsRenderingMode constants.

setDmlEffectsRenderingMode(int value)

public void setDmlEffectsRenderingMode(int value)

Sets a value determining how DrawingML effects are rendered. The default value is DmlEffectsRenderingMode.SIMPLIFIED.

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

Parameters:

Parameter Type Description
value int A value determining how DrawingML effects are rendered. The value must be one of DmlEffectsRenderingMode constants.

setDmlRenderingMode(int value)

public void setDmlRenderingMode(int value)

Sets a value determining how DrawingML shapes are rendered. The default value is DmlRenderingMode.FALLBACK.

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

Parameters:

Parameter Type Description
value int A value determining how DrawingML shapes are rendered. The value must be one of DmlRenderingMode constants.

setExportGeneratorName(boolean value)

public void setExportGeneratorName(boolean value)

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

Parameters:

Parameter Type Description
value boolean The corresponding boolean value.

setImlRenderingMode(int value)

public void setImlRenderingMode(int value)

Sets a value determining how ink (InkML) objects are rendered. The default value is ImlRenderingMode.INK_ML.

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

Parameters:

Parameter Type Description
value int A value determining how ink (InkML) objects are rendered. The value must be one of ImlRenderingMode constants.

setMemoryOptimization(boolean value)

public void setMemoryOptimization(boolean value)

Sets value determining if memory optimization should be performed before saving the document. Default value for this property is false . Setting this option to true can significantly decrease memory consumption while saving large documents at the cost of slower saving time.

Parameters:

Parameter Type Description
value boolean Value determining if memory optimization should be performed before saving the document.

setPrettyFormat(boolean value)

public void setPrettyFormat(boolean value)

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

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

Parameters:

Parameter Type Description
value boolean The corresponding boolean value.

setProgressCallback(IDocumentSavingCallback value)

public void setProgressCallback(IDocumentSavingCallback value)

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

Progress is reported when saving to SaveFormat.DOCX, SaveFormat.FLAT_OPC, SaveFormat.DOCM, SaveFormat.DOTM, SaveFormat.DOTX, SaveFormat.HTML, SaveFormat.MHTML, SaveFormat.EPUB, SaveFormat.XAML_FLOW, or SaveFormat.XAML_FLOW_PACK.

Parameters:

Parameter Type Description
value IDocumentSavingCallback The corresponding IDocumentSavingCallback value.

setSaveFormat(int value)

public abstract void setSaveFormat(int value)

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

Parameters:

Parameter Type Description
value int The corresponding int value. The value must be one of SaveFormat constants.

setTempFolder(String value)

public void setTempFolder(String value)

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.

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.

If you are saving a very large document (thousands of pages) and/or processing many documents at the same time, then the memory spike during saving can be significant enough to cause the system to throw java.lang.IndexOutOfBoundsException. Specifying a temporary folder using getTempFolder() / setTempFolder(java.lang.String) 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.

Parameters:

Parameter Type Description
value java.lang.String The corresponding java.lang.String value.

setUpdateCreatedTimeProperty(boolean value)

public void setUpdateCreatedTimeProperty(boolean value)

Sets a value determining whether the BuiltInDocumentProperties.getCreatedTime() / BuiltInDocumentProperties.setCreatedTime(java.util.Date) property is updated before saving. Default value is false ;

Parameters:

Parameter Type Description
value boolean A value determining whether the BuiltInDocumentProperties.getCreatedTime() / BuiltInDocumentProperties.setCreatedTime(java.util.Date) property is updated before saving.

setUpdateFields(boolean value)

public void setUpdateFields(boolean value)

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 . Allows to specify whether to mimic or not MS Word behavior.

Parameters:

Parameter Type Description
value boolean A value determining if fields of certain types should be updated before saving the document to a fixed page format.

setUpdateLastPrintedProperty(boolean value)

public void setUpdateLastPrintedProperty(boolean value)

Sets a value determining whether the BuiltInDocumentProperties.getLastPrinted() / BuiltInDocumentProperties.setLastPrinted(java.util.Date) property is updated before saving.

Parameters:

Parameter Type Description
value boolean A value determining whether the BuiltInDocumentProperties.getLastPrinted() / BuiltInDocumentProperties.setLastPrinted(java.util.Date) property is updated before saving.

setUpdateLastSavedTimeProperty(boolean value)

public void setUpdateLastSavedTimeProperty(boolean value)

Sets a value determining whether the BuiltInDocumentProperties.getLastSavedTime() / BuiltInDocumentProperties.setLastSavedTime(java.util.Date) property is updated before saving.

Parameters:

Parameter Type Description
value boolean A value determining whether the BuiltInDocumentProperties.getLastSavedTime() / BuiltInDocumentProperties.setLastSavedTime(java.util.Date) property is updated before saving.

setUpdateSdtContent(boolean value)

public void setUpdateSdtContent(boolean value)

Sets value determining whether content of StructuredDocumentTag is updated before saving. The default value is false .

Parameters:

Parameter Type Description
value boolean Value determining whether content of StructuredDocumentTag is updated before saving.

setUseAntiAliasing(boolean value)

public void setUseAntiAliasing(boolean value)

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

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: SaveFormat.TIFF, SaveFormat.PNG, SaveFormat.BMP, SaveFormat.JPEG, SaveFormat.EMF. When the document is exported to the SaveFormat.HTML, SaveFormat.MHTML, SaveFormat.EPUB, SaveFormat.AZW_3 or SaveFormat.MOBI formats this option is used for raster images.

Parameters:

Parameter Type Description
value boolean A value determining whether or not to use anti-aliasing for rendering.

setUseHighQualityRendering(boolean value)

public void setUseHighQualityRendering(boolean value)

Sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms. The default value is false .

This property is used when the document is exported to image formats: SaveFormat.TIFF, SaveFormat.PNG, SaveFormat.BMP, SaveFormat.JPEG, SaveFormat.EMF.

Parameters:

Parameter Type Description
value boolean A value determining whether or not to use high quality (i.e.

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

Parameter Type Description
arg0 long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

Parameter Type Description
arg0 long
arg1 int