LoadOptions

Inheritance: java.lang.Object

public class LoadOptions

Allows to specify additional options (such as password or base URI) when loading a document into a Document object.

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

Constructors

Constructor Description
LoadOptions() Initializes a new instance of this class with default values.
LoadOptions(String password) A shortcut to initialize a new instance of this class with the specified password to load an encrypted document.
LoadOptions(int loadFormat, String password, String baseUri) Initializes a new instance of this class.

Methods

Method Description
equals(Object arg0)
getBaseUri() Gets the string that will be used to resolve relative URIs found in the document into absolute URIs when required.
getClass()
getConvertMetafilesToPng() Gets whether to convert metafile ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) images to F:Aspose.FileFormat.Png image format.
getConvertShapeToOfficeMath() Gets whether to convert shapes with EquationXML to Office Math objects.
getEncoding() Gets the encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document.
getFontSettings() Allows to specify document font settings.
getIgnoreOleData() Specifies whether to ignore the OLE data.
getLanguagePreferences() Gets language preferences that will be used when document is loading.
getLoadFormat() Specifies the format of the document to be loaded.
getMswVersion() Allows to specify that the document loading process should match a specific MS Word version.
getPassword() Gets the password for opening an encrypted document.
getPreserveIncludePictureField() Gets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats.
getProgressCallback() Called during loading a document and accepts data about loading progress.
getResourceLoadingCallback() Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.
getTempFolder() Allows to use temporary files when reading document.
getUpdateDirtyFields() Specifies whether to update the fields with the dirty attribute.
getWarningCallback() Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss.
hashCode()
notify()
notifyAll()
setBaseUri(String value) Sets the string that will be used to resolve relative URIs found in the document into absolute URIs when required.
setConvertMetafilesToPng(boolean value) Sets whether to convert metafile ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) images to F:Aspose.FileFormat.Png image format.
setConvertShapeToOfficeMath(boolean value) Sets whether to convert shapes with EquationXML to Office Math objects.
setEncoding(Charset value) Sets the encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document.
setFontSettings(FontSettings value) Allows to specify document font settings.
setIgnoreOleData(boolean value) Specifies whether to ignore the OLE data.
setLoadFormat(int value) Specifies the format of the document to be loaded.
setMswVersion(int value) Allows to specify that the document loading process should match a specific MS Word version.
setPassword(String value) Sets the password for opening an encrypted document.
setPreserveIncludePictureField(boolean value) Sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats.
setProgressCallback(IDocumentLoadingCallback value) Called during loading a document and accepts data about loading progress.
setResourceLoadingCallback(IResourceLoadingCallback value) Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.
setTempFolder(String value) Allows to use temporary files when reading document.
setUpdateDirtyFields(boolean value) Specifies whether to update the fields with the dirty attribute.
setWarningCallback(IWarningCallback value) Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

LoadOptions()

public LoadOptions()

Initializes a new instance of this class with default values.

LoadOptions(String password)

public LoadOptions(String password)

A shortcut to initialize a new instance of this class with the specified password to load an encrypted document.

Parameters:

Parameter Type Description
password java.lang.String The password to open an encrypted document. Can be null or empty string.

LoadOptions(int loadFormat, String password, String baseUri)

public LoadOptions(int loadFormat, String password, String baseUri)

Initializes a new instance of this class.

Parameters:

Parameter Type Description
loadFormat int
password java.lang.String
baseUri java.lang.String

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

Parameter Type Description
arg0 java.lang.Object

Returns: boolean

getBaseUri()

public String getBaseUri()

Gets the string that will be used to resolve relative URIs found in the document into absolute URIs when required. Can be null or empty string. Default is null .

This property is used to resolve relative URIs into absolute in the following cases:

  1. When loading an HTML document from a stream and the document contains images with relative URIs and does not have a base URI specified in the BASE HTML element.
  2. When saving a document to PDF and other formats, to retrieve images linked using relative URIs so the images can be saved into the output document.

Returns: java.lang.String - The string that will be used to resolve relative URIs found in the document into absolute URIs when required.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getConvertMetafilesToPng()

public boolean getConvertMetafilesToPng()

Gets whether to convert metafile ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) images to F:Aspose.FileFormat.Png image format. Metafiles ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) is an uncompressed image format and sometimes requires to much RAM to hold and process document. This option allows to convert all metafile images to F:Aspose.FileFormat.Png on document loading. Please note - conversion vector graphics to raster decreases quality of the images.

Returns: boolean - Whether to convert metafile ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) images to F:Aspose.FileFormat.Png image format.

getConvertShapeToOfficeMath()

public boolean getConvertShapeToOfficeMath()

Gets whether to convert shapes with EquationXML to Office Math objects.

Returns: boolean - Whether to convert shapes with EquationXML to Office Math objects.

getEncoding()

public Charset getEncoding()

Gets the encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document. Can be null . Default is null .

This property is used only when loading HTML, TXT, or CHM documents.

If encoding is not specified inside the document and this property is null , then the system will try to automatically detect the encoding.

Returns: java.nio.charset.Charset - The encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document.

getFontSettings()

public FontSettings getFontSettings()

Allows to specify document font settings.

When loading some formats, Aspose.Words may require to resolve the fonts. For example, when loading HTML documents Aspose.Words may resolve the fonts to perform font fallback.

If set to null , default static font settings FontSettings.getDefaultInstance() will be used.

The default value is null .

Returns: FontSettings - The corresponding FontSettings value.

getIgnoreOleData()

public boolean getIgnoreOleData()

Specifies whether to ignore the OLE data.

Ignoring OLE data may reduce memory consumption and increase performance without data lost in a case when destination format does not support OLE objects.

The default value is false .

Returns: boolean - The corresponding boolean value.

getLanguagePreferences()

public LanguagePreferences getLanguagePreferences()

Gets language preferences that will be used when document is loading.

Returns: LanguagePreferences - Language preferences that will be used when document is loading.

getLoadFormat()

public int getLoadFormat()

Specifies the format of the document to be loaded. Default is LoadFormat.AUTO.

It is recommended that you specify the LoadFormat.AUTO value and let Aspose.Words detect the file format automatically. If you know the format of the document you are about to load, you can specify the format explicitly and this will slightly reduce the loading time by the overhead associated with auto detecting the format. If you specify an explicit load format and it will turn out to be wrong, the auto detection will be invoked and a second attempt to load the file will be made.

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

getMswVersion()

public int getMswVersion()

Allows to specify that the document loading process should match a specific MS Word version. Default value is MsWordVersion.WORD_2019 Different Word versions may handle certain aspects of document content and formatting slightly differently during the loading process, which may result in minor differences in Document Object Model.

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

getPassword()

public String getPassword()

Gets the password for opening an encrypted document. Can be null or empty string. Default is null .

You need to know the password to open an encrypted document. If the document is not encrypted, set this to null or empty string.

Returns: java.lang.String - The password for opening an encrypted document.

getPreserveIncludePictureField()

public boolean getPreserveIncludePictureField()

Gets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats. The default value is false .

By default, the INCLUDEPICTURE field is converted into a shape object. You can override that if you need the field to be preserved, for example, if you wish to update it programmatically. Note however that this approach is not common for Aspose.Words. Use it on your own risk.

One of the possible use cases may be using a MERGEFIELD as a child field to dynamically change the source path of the picture. In this case you need the INCLUDEPICTURE to be preserved in the model.

Returns: boolean - Whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats.

getProgressCallback()

public IDocumentLoadingCallback getProgressCallback()

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

LoadFormat.DOCX, LoadFormat.FLAT_OPC, LoadFormat.DOCM, LoadFormat.DOTM, LoadFormat.DOTX, LoadFormat.MARKDOWN, LoadFormat.RTF, LoadFormat.WORD_ML, LoadFormat.DOC, LoadFormat.DOT, LoadFormat.ODT, LoadFormat.OTT formats supported.

Returns: IDocumentLoadingCallback - The corresponding IDocumentLoadingCallback value.

getResourceLoadingCallback()

public IResourceLoadingCallback getResourceLoadingCallback()

Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.

Returns: IResourceLoadingCallback - The corresponding IResourceLoadingCallback value.

getTempFolder()

public String getTempFolder()

Allows to use temporary files when reading document. By default this property is null and no temporary files are used.

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

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

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

getUpdateDirtyFields()

public boolean getUpdateDirtyFields()

Specifies whether to update the fields with the dirty attribute.

Returns: boolean - The corresponding boolean value.

getWarningCallback()

public IWarningCallback getWarningCallback()

Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss.

Returns: IWarningCallback - The corresponding IWarningCallback value.

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setBaseUri(String value)

public void setBaseUri(String value)

Sets the string that will be used to resolve relative URIs found in the document into absolute URIs when required. Can be null or empty string. Default is null .

This property is used to resolve relative URIs into absolute in the following cases:

  1. When loading an HTML document from a stream and the document contains images with relative URIs and does not have a base URI specified in the BASE HTML element.
  2. When saving a document to PDF and other formats, to retrieve images linked using relative URIs so the images can be saved into the output document.

Parameters:

Parameter Type Description
value java.lang.String The string that will be used to resolve relative URIs found in the document into absolute URIs when required.

setConvertMetafilesToPng(boolean value)

public void setConvertMetafilesToPng(boolean value)

Sets whether to convert metafile ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) images to F:Aspose.FileFormat.Png image format. Metafiles ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) is an uncompressed image format and sometimes requires to much RAM to hold and process document. This option allows to convert all metafile images to F:Aspose.FileFormat.Png on document loading. Please note - conversion vector graphics to raster decreases quality of the images.

Parameters:

Parameter Type Description
value boolean Whether to convert metafile ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) images to F:Aspose.FileFormat.Png image format.

setConvertShapeToOfficeMath(boolean value)

public void setConvertShapeToOfficeMath(boolean value)

Sets whether to convert shapes with EquationXML to Office Math objects.

Parameters:

Parameter Type Description
value boolean Whether to convert shapes with EquationXML to Office Math objects.

setEncoding(Charset value)

public void setEncoding(Charset value)

Sets the encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document. Can be null . Default is null .

This property is used only when loading HTML, TXT, or CHM documents.

If encoding is not specified inside the document and this property is null , then the system will try to automatically detect the encoding.

Parameters:

Parameter Type Description
value java.nio.charset.Charset The encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document.

setFontSettings(FontSettings value)

public void setFontSettings(FontSettings value)

Allows to specify document font settings.

When loading some formats, Aspose.Words may require to resolve the fonts. For example, when loading HTML documents Aspose.Words may resolve the fonts to perform font fallback.

If set to null , default static font settings FontSettings.getDefaultInstance() will be used.

The default value is null .

Parameters:

Parameter Type Description
value FontSettings The corresponding FontSettings value.

setIgnoreOleData(boolean value)

public void setIgnoreOleData(boolean value)

Specifies whether to ignore the OLE data.

Ignoring OLE data may reduce memory consumption and increase performance without data lost in a case when destination format does not support OLE objects.

The default value is false .

Parameters:

Parameter Type Description
value boolean The corresponding boolean value.

setLoadFormat(int value)

public void setLoadFormat(int value)

Specifies the format of the document to be loaded. Default is LoadFormat.AUTO.

It is recommended that you specify the LoadFormat.AUTO value and let Aspose.Words detect the file format automatically. If you know the format of the document you are about to load, you can specify the format explicitly and this will slightly reduce the loading time by the overhead associated with auto detecting the format. If you specify an explicit load format and it will turn out to be wrong, the auto detection will be invoked and a second attempt to load the file will be made.

Parameters:

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

setMswVersion(int value)

public void setMswVersion(int value)

Allows to specify that the document loading process should match a specific MS Word version. Default value is MsWordVersion.WORD_2019 Different Word versions may handle certain aspects of document content and formatting slightly differently during the loading process, which may result in minor differences in Document Object Model.

Parameters:

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

setPassword(String value)

public void setPassword(String value)

Sets the password for opening an encrypted document. Can be null or empty string. Default is null .

You need to know the password to open an encrypted document. If the document is not encrypted, set this to null or empty string.

Parameters:

Parameter Type Description
value java.lang.String The password for opening an encrypted document.

setPreserveIncludePictureField(boolean value)

public void setPreserveIncludePictureField(boolean value)

Sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats. The default value is false .

By default, the INCLUDEPICTURE field is converted into a shape object. You can override that if you need the field to be preserved, for example, if you wish to update it programmatically. Note however that this approach is not common for Aspose.Words. Use it on your own risk.

One of the possible use cases may be using a MERGEFIELD as a child field to dynamically change the source path of the picture. In this case you need the INCLUDEPICTURE to be preserved in the model.

Parameters:

Parameter Type Description
value boolean Whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats.

setProgressCallback(IDocumentLoadingCallback value)

public void setProgressCallback(IDocumentLoadingCallback value)

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

LoadFormat.DOCX, LoadFormat.FLAT_OPC, LoadFormat.DOCM, LoadFormat.DOTM, LoadFormat.DOTX, LoadFormat.MARKDOWN, LoadFormat.RTF, LoadFormat.WORD_ML, LoadFormat.DOC, LoadFormat.DOT, LoadFormat.ODT, LoadFormat.OTT formats supported.

Parameters:

Parameter Type Description
value IDocumentLoadingCallback The corresponding IDocumentLoadingCallback value.

setResourceLoadingCallback(IResourceLoadingCallback value)

public void setResourceLoadingCallback(IResourceLoadingCallback value)

Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.

Parameters:

Parameter Type Description
value IResourceLoadingCallback The corresponding IResourceLoadingCallback value.

setTempFolder(String value)

public void setTempFolder(String value)

Allows to use temporary files when reading document. By default this property is null and no temporary files are used.

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

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

Parameters:

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

setUpdateDirtyFields(boolean value)

public void setUpdateDirtyFields(boolean value)

Specifies whether to update the fields with the dirty attribute.

Parameters:

Parameter Type Description
value boolean The corresponding boolean value.

setWarningCallback(IWarningCallback value)

public void setWarningCallback(IWarningCallback value)

Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss.

Parameters:

Parameter Type Description
value IWarningCallback The corresponding IWarningCallback value.

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