public class RtfLoadOptions extends LoadOptions
LoadFormat.RTF document into a Document object.
To learn more, visit the Specify Load Options documentation article.
Examples:
Shows how to detect UTF-8 characters while loading an RTF document.
// Create an "RtfLoadOptions" object to modify how we load an RTF document.
RtfLoadOptions loadOptions = new RtfLoadOptions();
// Set the "RecognizeUtf8Text" property to "false" to assume that the document uses the ISO 8859-1 charset
// and loads every character in the document.
// Set the "RecognizeUtf8Text" property to "true" to parse any variable-length characters that may occur in the text.
loadOptions.setRecognizeUtf8Text(recognizeUtf8Text);
Document doc = new Document(getMyDir() + "UTF-8 characters.rtf", loadOptions);
Assert.assertEquals(
recognizeUtf8Text
? "“John Doe´s list of currency symbols”™\r" +
"€, ¢, £, ¥, ¤"
: "“John Doe´s list of currency symbolsâ€â„¢\r" +
"€, ¢, £, ¥, ¤",
doc.getFirstSection().getBody().getText().trim());
| Constructor and Description |
|---|
RtfLoadOptions()
Initializes a new instance of this class with default values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getRecognizeUtf8Text()
When set to
true, will try to detect UTF8 characters, they will be preserved during import. |
void |
setRecognizeUtf8Text(boolean value)
When set to
true, will try to detect UTF8 characters, they will be preserved during import. |
equals, getBaseUri, getConvertMetafilesToPng, getConvertShapeToOfficeMath, getEncoding, getFontSettings, getIgnoreOleData, getLanguagePreferences, getLoadFormat, getMswVersion, getPassword, getPreserveIncludePictureField, getProgressCallback, getRecoveryMode, getResourceLoadingCallback, getTempFolder, getUpdateDirtyFields, getUseSystemLcid, getWarningCallback, setBaseUri, setConvertMetafilesToPng, setConvertShapeToOfficeMath, setEncoding, setFontSettings, setIgnoreOleData, setLoadFormat, setMswVersion, setPassword, setPreserveIncludePictureField, setProgressCallback, setRecoveryMode, setResourceLoadingCallback, setTempFolder, setUpdateDirtyFields, setUseSystemLcid, setWarningCallbackpublic RtfLoadOptions()
Examples:
Shows how to detect UTF-8 characters while loading an RTF document.
// Create an "RtfLoadOptions" object to modify how we load an RTF document.
RtfLoadOptions loadOptions = new RtfLoadOptions();
// Set the "RecognizeUtf8Text" property to "false" to assume that the document uses the ISO 8859-1 charset
// and loads every character in the document.
// Set the "RecognizeUtf8Text" property to "true" to parse any variable-length characters that may occur in the text.
loadOptions.setRecognizeUtf8Text(recognizeUtf8Text);
Document doc = new Document(getMyDir() + "UTF-8 characters.rtf", loadOptions);
Assert.assertEquals(
recognizeUtf8Text
? "“John Doe´s list of currency symbols”™\r" +
"€, ¢, £, ¥, ¤"
: "“John Doe´s list of currency symbolsâ€â„¢\r" +
"€, ¢, £, ¥, ¤",
doc.getFirstSection().getBody().getText().trim());
public boolean getRecognizeUtf8Text()
When set to true, will try to detect UTF8 characters, they will be preserved during import.
Remarks:
Default value is false.
Examples:
Shows how to detect UTF-8 characters while loading an RTF document.
// Create an "RtfLoadOptions" object to modify how we load an RTF document.
RtfLoadOptions loadOptions = new RtfLoadOptions();
// Set the "RecognizeUtf8Text" property to "false" to assume that the document uses the ISO 8859-1 charset
// and loads every character in the document.
// Set the "RecognizeUtf8Text" property to "true" to parse any variable-length characters that may occur in the text.
loadOptions.setRecognizeUtf8Text(recognizeUtf8Text);
Document doc = new Document(getMyDir() + "UTF-8 characters.rtf", loadOptions);
Assert.assertEquals(
recognizeUtf8Text
? "“John Doe´s list of currency symbols”™\r" +
"€, ¢, £, ¥, ¤"
: "“John Doe´s list of currency symbolsâ€â„¢\r" +
"€, ¢, £, ¥, ¤",
doc.getFirstSection().getBody().getText().trim());
boolean value.public void setRecognizeUtf8Text(boolean value)
When set to true, will try to detect UTF8 characters, they will be preserved during import.
Remarks:
Default value is false.
Examples:
Shows how to detect UTF-8 characters while loading an RTF document.
// Create an "RtfLoadOptions" object to modify how we load an RTF document.
RtfLoadOptions loadOptions = new RtfLoadOptions();
// Set the "RecognizeUtf8Text" property to "false" to assume that the document uses the ISO 8859-1 charset
// and loads every character in the document.
// Set the "RecognizeUtf8Text" property to "true" to parse any variable-length characters that may occur in the text.
loadOptions.setRecognizeUtf8Text(recognizeUtf8Text);
Document doc = new Document(getMyDir() + "UTF-8 characters.rtf", loadOptions);
Assert.assertEquals(
recognizeUtf8Text
? "“John Doe´s list of currency symbols”™\r" +
"€, ¢, £, ¥, ¤"
: "“John Doe´s list of currency symbolsâ€â„¢\r" +
"€, ¢, £, ¥, ¤",
doc.getFirstSection().getBody().getText().trim());
value - The corresponding boolean value.