Aspose::Words::Loading::TxtLoadOptions class
Contents
[
Hide
]TxtLoadOptions class
Allows to specify additional options when loading Text document into a Document object. To learn more, visit the Specify Load Options documentation article.
class TxtLoadOptions : public LoadOptions
Methods
| Method | Description |
|---|---|
| TxtLoadOptions() | Initializes a new instance of this class with default values. |
| get_AutoNumberingDetection() const | Gets or sets a boolean value indicating either automatic numbering detection will be performed while loading a document. The default value is true. |
| get_DetectHyperlinks() const | Specifies either to detect hyperlinks in text. The default value is false. |
| get_DetectNumberingWithWhitespaces() const | Allows to specify how numbered list items are recognized when document is imported from plain text format. The default value is true. |
| get_DocumentDirection() const | Gets or sets a document direction. The default value is LeftToRight. |
| get_LeadingSpacesOptions() const | Gets or sets preferred option of a leading space handling. Default value is ConvertToIndent. |
| get_TrailingSpacesOptions() const | Gets or sets preferred option of a trailing space handling. Default value is Trim. |
| set_AutoNumberingDetection(bool) | Sets a boolean value indicating either automatic numbering detection will be performed while loading a document. The default value is true. |
| set_DetectHyperlinks(bool) | Specifies either to detect hyperlinks in text. The default value is false. |
| set_DetectNumberingWithWhitespaces(bool) | Allows to specify how numbered list items are recognized when document is imported from plain text format. The default value is true. |
| set_DocumentDirection(Aspose::Words::Loading::DocumentDirection) | Sets a document direction. The default value is LeftToRight. |
| set_LeadingSpacesOptions(Aspose::Words::Loading::TxtLeadingSpacesOptions) | Sets preferred option of a leading space handling. Default value is ConvertToIndent. |
| set_TrailingSpacesOptions(Aspose::Words::Loading::TxtTrailingSpacesOptions) | Sets preferred option of a trailing space handling. Default value is Trim. |
| Equals(System::SharedPtr<System::Object>) override | Determines whether the specified object is equal in value to the current object. |
| LoadOptions() | Initializes a new instance of this class with default values. |
| LoadOptions(Aspose::Words::LoadFormat, const System::String &, const System::String &) | A shortcut to initialize a new instance of this class with properties set to the specified values. |
| LoadOptions(const System::String &) | A shortcut to initialize a new instance of this class with the specified password to load an encrypted document. |
| 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. |
| get_ConvertMetafilesToPng() const | Gets or sets whether to convert metafile(Wmf or Emf) images to Png image format. |
| get_ConvertShapeToOfficeMath() const | Gets or sets whether to convert shapes with EquationXML to Office Math objects. |
| get_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. |
| get_FontSettings() const | Allows to specify document font settings. |
| get_IgnoreOleData() const | Specifies whether to ignore the OLE data. |
| get_LanguagePreferences() const | Gets language preferences that will be used when document is loading. |
| get_LoadFormat() const | Specifies the format of the document to be loaded. Default is Auto. |
| get_MswVersion() const | Allows to specify that the document loading process should match a specific MS Word version. Default value is Word2019 |
| get_Password() const | Gets or sets the password for opening an encrypted document. Can be null or empty string. Default is null. |
| get_PreserveIncludePictureField() const | Gets or sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats. The default value is false. |
| get_ProgressCallback() const | Called during loading a document and accepts data about loading progress. |
| get_RecoveryMode() const | Defines how the document should be handled if errors occur during loading. Use this property to specify whether the system should attempt to recover the document or follow another defined behavior. The default value is TryRecover. |
| get_ResourceLoadingCallback() const | Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML. |
| get_TempFolder() const | Allows to use temporary files when reading document. By default this property is null and no temporary files are used. |
| get_UpdateDirtyFields() const | Specifies whether to update the fields with the dirty attribute. |
| get_UseSystemLcid() const | Gets or sets whether to use LCID value obtained from Windows registry to determine page setup default margins. |
| get_WarningCallback() const | Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss. |
| set_BaseUri(const System::String &) | 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. |
| set_ConvertMetafilesToPng(bool) | Sets whether to convert metafile(Wmf or Emf) images to Png image format. |
| set_ConvertShapeToOfficeMath(bool) | Sets whether to convert shapes with EquationXML to Office Math objects. |
| set_Encoding(const System::SharedPtr<System::Text::Encoding> &) | 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. |
| set_FontSettings(const System::SharedPtr<Aspose::Words::Fonts::FontSettings> &) | Allows to specify document font settings. |
| set_IgnoreOleData(bool) | Specifies whether to ignore the OLE data. |
| set_LoadFormat(Aspose::Words::LoadFormat) | Specifies the format of the document to be loaded. Default is Auto. |
| set_MswVersion(Aspose::Words::Settings::MsWordVersion) | Allows to specify that the document loading process should match a specific MS Word version. Default value is Word2019 |
| set_Password(const System::String &) | Sets the password for opening an encrypted document. Can be null or empty string. Default is null. |
| set_PreserveIncludePictureField(bool) | Sets whether to preserve the INCLUDEPICTURE field when reading Microsoft Word formats. The default value is false. |
| set_ProgressCallback(const System::SharedPtr<Aspose::Words::Loading::IDocumentLoadingCallback> &) | Called during loading a document and accepts data about loading progress. |
| set_RecoveryMode(Aspose::Words::Loading::DocumentRecoveryMode) | Defines how the document should be handled if errors occur during loading. Use this property to specify whether the system should attempt to recover the document or follow another defined behavior. The default value is TryRecover. |
| set_ResourceLoadingCallback(const System::SharedPtr<Aspose::Words::Loading::IResourceLoadingCallback> &) | Allows to control how external resources (images, style sheets) are loaded when a document is imported from HTML, MHTML. |
| set_TempFolder(const System::String &) | Allows to use temporary files when reading document. By default this property is null and no temporary files are used. |
| set_UpdateDirtyFields(bool) | Specifies whether to update the fields with the dirty attribute. |
| set_UseSystemLcid(bool) | Sets whether to use LCID value obtained from Windows registry to determine page setup default margins. |
| set_WarningCallback(const System::SharedPtr<Aspose::Words::IWarningCallback> &) | Called during a load operation, when an issue is detected that might result in data or formatting fidelity loss. |
Examples
Shows how to read and display hyperlinks.
const System::String inputText = System::String(u"Some links in TXT:\n") + u"https://www.aspose.com/\n" + u"https://docs.aspose.com/words/net/\n";
{
System::SharedPtr<System::IO::Stream> stream = System::MakeObject<System::IO::MemoryStream>();
System::ArrayPtr<uint8_t> buf = System::Text::Encoding::get_ASCII()->GetBytes(inputText);
stream->Write(buf, 0, buf->get_Length());
auto loadOptions = System::MakeObject<Aspose::Words::Loading::TxtLoadOptions>();
loadOptions->set_DetectHyperlinks(true);
// Load document with hyperlinks.
auto doc = System::MakeObject<Aspose::Words::Document>(stream, loadOptions);
// Print hyperlinks text.
for (auto&& field : System::IterateOver(doc->get_Range()->get_Fields()))
{
std::cout << field->get_Result() << std::endl;
}
ASSERT_EQ(u"https://www.aspose.com/", doc->get_Range()->get_Fields()->idx_get(0)->get_Result().Trim());
ASSERT_EQ(u"https://docs.aspose.com/words/net/", doc->get_Range()->get_Fields()->idx_get(1)->get_Result().Trim());
}
See Also
- Class LoadOptions
- Namespace Aspose::Words::Loading
- Library Aspose.Words for C++