Aspose::Words::Loading::RtfLoadOptions Class Reference

Detailed Description

Allows to specify additional options when loading Rtf document into a Document object.

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.
auto loadOptions = MakeObject<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->set_RecognizeUtf8Text(recognizeUtf8Text);
auto doc = MakeObject<Document>(MyDir + u"UTF-8 characters.rtf", loadOptions);
ASSERT_EQ(recognizeUtf8Text ? String(u"“John Doe´s list of currency symbols”™\r") + u"€, ¢, £, ¥, ¤"
: String(u"“John Doe´s list of currency symbolsâ€\u009dâ„¢\r") + u"€, ¢, £, Â¥, ¤",
doc->get_FirstSection()->get_Body()->GetText().Trim());

#include <Aspose.Words.Cpp/Loading/RtfLoadOptions.h>

+ Inheritance diagram for Aspose::Words::Loading::RtfLoadOptions:

Public Member Functions

 RtfLoadOptions ()
 Initializes a new instance of this class with default values. More...
 
bool get_RecognizeUtf8Text () const
 When set to true, CharsetDetector will try to detect UTF8 characters, they will be preserved during import. Default value is false. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_RecognizeUtf8Text (bool value)
 Setter for get_RecognizeUtf8Text. More...
 
- Public Member Functions inherited from LoadOptions
 LoadOptions ()
 Initializes a new instance of this class with default values. More...
 
 LoadOptions (LoadFormat loadFormat, String password, String baseUri)
 A shortcut to initialize a new instance of this class with properties set to the specified values. More...
 
 LoadOptions (String password)
 A shortcut to initialize a new instance of this class with the specified password to load an encrypted document. More...
 
String get_BaseUri () const
 Gets or 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. More...
 
bool get_ConvertMetafilesToPng () const
 Gets or sets whether to convert metafile (Wmf or Emf) images to Png image format. More...
 
bool get_ConvertShapeToOfficeMath () const
 Gets or sets whether to convert shapes with EquationXML to Office Math objects. More...
 
SharedPtr< Encodingget_Encoding () const
 Gets or 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. More...
 
SharedPtr< FontSettingsget_FontSettings () const
 Allows to specify document font settings. More...
 
SharedPtr< LanguagePreferencesget_LanguagePreferences () const
 Gets language preferences that will be used when document is loading. More...
 
LoadFormat get_LoadFormat () const
 Specifies the format of the document to be loaded. Default is Auto. More...
 
MsWordVersion get_MswVersion () const
 Allows to specify that the document loading process should match a specific MS Word version. Default value is Word2007 More...
 
String get_Password () const
 Gets or sets the password for opening an encrypted document. Can be null or empty string. Default is null. More...
 
bool get_PreserveIncludePictureField () const
 Gets or sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats. The default value is false. More...
 
SharedPtr< IResourceLoadingCallbackget_ResourceLoadingCallback () const
 Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML. More...
 
String get_TempFolder () const
 Allows to use temporary files when reading document. By default this property is null and no temporary files are used. More...
 
bool get_UpdateDirtyFields () const
 Specifies whether to update the fields with the dirty attribute. More...
 
SharedPtr< IWarningCallbackget_WarningCallback () const
 Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss. More...
 
void set_BaseUri (String value)
 Setter for get_BaseUri. More...
 
void set_ConvertMetafilesToPng (bool value)
 Setter for get_ConvertMetafilesToPng. More...
 
void set_ConvertShapeToOfficeMath (bool value)
 Setter for get_ConvertShapeToOfficeMath. More...
 
void set_Encoding (SharedPtr< Encoding > value)
 Setter for get_Encoding. More...
 
void set_FontSettings (SharedPtr< FontSettings > value)
 Setter for get_FontSettings. More...
 
void set_LoadFormat (LoadFormat value)
 Setter for get_LoadFormat. More...
 
void set_MswVersion (MsWordVersion value)
 Setter for get_MswVersion. More...
 
void set_Password (String value)
 Setter for get_Password. More...
 
void set_PreserveIncludePictureField (bool value)
 Setter for get_PreserveIncludePictureField. More...
 
void set_ResourceLoadingCallback (SharedPtr< IResourceLoadingCallback > value)
 Setter for get_ResourceLoadingCallback. More...
 
void set_TempFolder (String value)
 Setter for get_TempFolder. More...
 
void set_UpdateDirtyFields (bool value)
 Setter for get_UpdateDirtyFields. More...
 
void set_WarningCallback (SharedPtr< IWarningCallback > value)
 Setter for get_WarningCallback. More...
 

Static Public Member Functions

static const TypeInfoType ()
 
- Static Public Member Functions inherited from LoadOptions
static const TypeInfoType ()
 

Constructor & Destructor Documentation

◆ RtfLoadOptions()

Aspose::Words::Loading::RtfLoadOptions::RtfLoadOptions ( )

Initializes a new instance of this class with default values.

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.
auto loadOptions = MakeObject<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->set_RecognizeUtf8Text(recognizeUtf8Text);
auto doc = MakeObject<Document>(MyDir + u"UTF-8 characters.rtf", loadOptions);
ASSERT_EQ(recognizeUtf8Text ? String(u"“John Doe´s list of currency symbols”™\r") + u"€, ¢, £, ¥, ¤"
: String(u"“John Doe´s list of currency symbolsâ€\u009dâ„¢\r") + u"€, ¢, £, Â¥, ¤",
doc->get_FirstSection()->get_Body()->GetText().Trim());

Member Function Documentation

◆ get_RecognizeUtf8Text()

bool Aspose::Words::Loading::RtfLoadOptions::get_RecognizeUtf8Text ( ) const

When set to true, CharsetDetector will try to detect UTF8 characters, they will be preserved during import. 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.
auto loadOptions = MakeObject<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->set_RecognizeUtf8Text(recognizeUtf8Text);
auto doc = MakeObject<Document>(MyDir + u"UTF-8 characters.rtf", loadOptions);
ASSERT_EQ(recognizeUtf8Text ? String(u"“John Doe´s list of currency symbols”™\r") + u"€, ¢, £, ¥, ¤"
: String(u"“John Doe´s list of currency symbolsâ€\u009dâ„¢\r") + u"€, ¢, £, Â¥, ¤",
doc->get_FirstSection()->get_Body()->GetText().Trim());

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Loading::RtfLoadOptions::GetType ( ) const
overridevirtual

◆ Is()

virtual bool Aspose::Words::Loading::RtfLoadOptions::Is ( const System::TypeInfo target) const
overridevirtual

◆ set_RecognizeUtf8Text()

void Aspose::Words::Loading::RtfLoadOptions::set_RecognizeUtf8Text ( bool  value)

◆ Type()

static const System::TypeInfo& Aspose::Words::Loading::RtfLoadOptions::Type ( )
static