Class RtfLoadOptions

Class RtfLoadOptions

Namespace: Aspose.Words.Loading
Assembly: Aspose.Words.dll (25.12.0)

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

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

public class RtfLoadOptions : LoadOptions

Inheritance

object LoadOptions RtfLoadOptions

Inherited Members

LoadOptions.Equals(object) , LoadOptions.LoadFormat , LoadOptions.Password , LoadOptions.BaseUri , LoadOptions.Encoding , LoadOptions.ResourceLoadingCallback , LoadOptions.WarningCallback , LoadOptions.ProgressCallback , LoadOptions.PreserveIncludePictureField , LoadOptions.ConvertShapeToOfficeMath , LoadOptions.FontSettings , LoadOptions.TempFolder , LoadOptions.ConvertMetafilesToPng , LoadOptions.MswVersion , LoadOptions.UpdateDirtyFields , LoadOptions.IgnoreOleData , LoadOptions.UseSystemLcid , LoadOptions.LanguagePreferences , LoadOptions.RecoveryMode , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

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.RecognizeUtf8Text = recognizeUtf8Text;

                                                                              Document doc = new Document(MyDir + "UTF-8 characters.rtf", loadOptions);

                                                                              Assert.That(doc.FirstSection.Body.GetText().Trim(), Is.EqualTo(recognizeUtf8Text
                                                                                      ? "“John Doe´s list of currency symbols”™\r" +
                                                                                        "€, ¢, £, ¥, ¤"
                                                                                      : "“John Doe´s list of currency symbolsâ€\u009dâ„¢\r" +
                                                                                        "€, ¢, £, ¥, ¤"));

Constructors

RtfLoadOptions()

Initializes a new instance of this class with default values.

public 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.RecognizeUtf8Text = recognizeUtf8Text;

                                                                              Document doc = new Document(MyDir + "UTF-8 characters.rtf", loadOptions);

                                                                              Assert.That(doc.FirstSection.Body.GetText().Trim(), Is.EqualTo(recognizeUtf8Text
                                                                                      ? "“John Doe´s list of currency symbols”™\r" +
                                                                                        "€, ¢, £, ¥, ¤"
                                                                                      : "“John Doe´s list of currency symbolsâ€\u009dâ„¢\r" +
                                                                                        "€, ¢, £, ¥, ¤"));

Properties

RecognizeUtf8Text

When set to true, will try to detect UTF8 characters, they will be preserved during import.

public bool RecognizeUtf8Text { get; set; }

Property Value

bool

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.RecognizeUtf8Text = recognizeUtf8Text;

                                                                              Document doc = new Document(MyDir + "UTF-8 characters.rtf", loadOptions);

                                                                              Assert.That(doc.FirstSection.Body.GetText().Trim(), Is.EqualTo(recognizeUtf8Text
                                                                                      ? "“John Doe´s list of currency symbols”™\r" +
                                                                                        "€, ¢, £, ¥, ¤"
                                                                                      : "“John Doe´s list of currency symbolsâ€\u009dâ„¢\r" +
                                                                                        "€, ¢, £, ¥, ¤"));

Remarks

Default value is false.

 English