public class LoadOptions
extends java.lang.Object
Document object.
To learn more, visit the Specify Load Options documentation article.
| Constructor and Description |
|---|
LoadOptions()
Initializes a new instance of this class with default values.
|
LoadOptions(int loadFormat,
java.lang.String password,
java.lang.String baseUri)
Initializes a new instance of this class.
|
LoadOptions(java.lang.String password)
A shortcut to initialize a new instance of this class with the specified password to load an encrypted document.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getBaseUri()
Gets the string that will be used to resolve relative URIs found in the document into absolute URIs when required.
|
boolean |
getConvertMetafilesToPng()
Gets whether to convert metafile ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) images to F:Aspose.FileFormat.Png image format.
|
boolean |
getConvertShapeToOfficeMath()
Gets whether to convert shapes with EquationXML to Office Math objects.
|
java.nio.charset.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.
|
FontSettings |
getFontSettings()
Allows to specify document font settings.
|
LanguagePreferences |
getLanguagePreferences()
Gets language preferences that will be used when document is loading.
|
int |
getLoadFormat()
Specifies the format of the document to be loaded.
|
int |
getMswVersion()
Allows to specify that the document loading process should match a specific MS Word version.
|
java.lang.String |
getPassword()
Gets the password for opening an encrypted document.
|
boolean |
getPreserveIncludePictureField()
Gets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats.
|
IDocumentLoadingCallback |
getProgressCallback()
Called during loading a document and accepts data about loading progress.
|
IResourceLoadingCallback |
getResourceLoadingCallback()
Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.
|
java.lang.String |
getTempFolder()
Allows to use temporary files when reading document.
|
boolean |
getUpdateDirtyFields()
Specifies whether to update the fields with the
dirty attribute. |
IWarningCallback |
getWarningCallback()
Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss.
|
void |
setBaseUri(java.lang.String value)
Sets the string that will be used to resolve relative URIs found in the document into absolute URIs when required.
|
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.
|
void |
setConvertShapeToOfficeMath(boolean value)
Sets whether to convert shapes with EquationXML to Office Math objects.
|
void |
setEncoding(java.nio.charset.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.
|
void |
setFontSettings(FontSettings value)
Allows to specify document font settings.
|
void |
setLoadFormat(int value)
Specifies the format of the document to be loaded.
|
void |
setMswVersion(int value)
Allows to specify that the document loading process should match a specific MS Word version.
|
void |
setPassword(java.lang.String value)
Sets the password for opening an encrypted document.
|
void |
setPreserveIncludePictureField(boolean value)
Sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats.
|
void |
setProgressCallback(IDocumentLoadingCallback value)
Called during loading a document and accepts data about loading progress.
|
void |
setResourceLoadingCallback(IResourceLoadingCallback value)
Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML.
|
void |
setTempFolder(java.lang.String value)
Allows to use temporary files when reading document.
|
void |
setUpdateDirtyFields(boolean value)
Specifies whether to update the fields with the
dirty attribute. |
void |
setWarningCallback(IWarningCallback value)
Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss.
|
public LoadOptions()
public LoadOptions(java.lang.String password)
password - The password to open an encrypted document. Can be null or empty string.public LoadOptions(int loadFormat,
java.lang.String password,
java.lang.String baseUri)
public int getLoadFormat()
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.
int value. The returned value is one of LoadFormat constants.public void setLoadFormat(int value)
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.
value - The corresponding int value. The value must be one of LoadFormat constants.public java.lang.String getPassword()
You need to know the password to open an encrypted document. If the document is not encrypted, set this to null or empty string.
public void setPassword(java.lang.String value)
You need to know the password to open an encrypted document. If the document is not encrypted, set this to null or empty string.
value - The password for opening an encrypted document.public java.lang.String getBaseUri()
This property is used to resolve relative URIs into absolute in the following cases:
public void setBaseUri(java.lang.String value)
This property is used to resolve relative URIs into absolute in the following cases:
value - The string that will be used to resolve relative URIs found in the document into absolute URIs when required.public java.nio.charset.Charset getEncoding()
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.
public void setEncoding(java.nio.charset.Charset value)
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.
value - The encoding that will be used to load an HTML, TXT, or CHM document if the encoding is not specified inside the document.public IResourceLoadingCallback getResourceLoadingCallback()
IResourceLoadingCallback value.public void setResourceLoadingCallback(IResourceLoadingCallback value)
value - The corresponding IResourceLoadingCallback value.public IWarningCallback getWarningCallback()
IWarningCallback value.public void setWarningCallback(IWarningCallback value)
value - The corresponding IWarningCallback value.public IDocumentLoadingCallback getProgressCallback()
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.
IDocumentLoadingCallback value.public void setProgressCallback(IDocumentLoadingCallback value)
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.
value - The corresponding IDocumentLoadingCallback value.public boolean getPreserveIncludePictureField()
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.
public void setPreserveIncludePictureField(boolean value)
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.
value - Whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats.public boolean getConvertShapeToOfficeMath()
public void setConvertShapeToOfficeMath(boolean value)
value - Whether to convert shapes with EquationXML to Office Math objects.public FontSettings getFontSettings()
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.
FontSettings value.public void setFontSettings(FontSettings value)
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.
value - The corresponding FontSettings value.public java.lang.String getTempFolder()
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.
String value.public void setTempFolder(java.lang.String value)
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.
value - The corresponding String value.public boolean getConvertMetafilesToPng()
public void setConvertMetafilesToPng(boolean value)
value - Whether to convert metafile ( F:Aspose.FileFormat.Wmf or F:Aspose.FileFormat.Emf) images to F:Aspose.FileFormat.Png image format.public int getMswVersion()
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.int value. The returned value is one of MsWordVersion constants.public void setMswVersion(int value)
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.value - The corresponding int value. The value must be one of MsWordVersion constants.public boolean getUpdateDirtyFields()
dirty attribute.boolean value.public void setUpdateDirtyFields(boolean value)
dirty attribute.value - The corresponding boolean value.public LanguagePreferences getLanguagePreferences()