Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
In this article, we will learn what options can be useful for working with a text document via Aspose.Words. Please note that this is not a complete list of available options, but only an example of working with some of them.
You can use the get_AddBidiMarks() property to specify whether to add bi-directional marks before each BiDi run when exporting in plain text format. Aspose.Words inserts Unicode Character ‘RIGHT-TO-LEFT MARK’ (U+200F) before each bi-directional Run in the text. This option corresponds to “Add bi-directional marks” option in MS Word File Conversion dialogue when you export to a Plain Text format. Note that it appears in dialogue only if any of Arabic or Hebrew editing languages are added in MS Word.
The following code example shows how to use get_AddBidiMarks() property. The default value of this property is false:
Aspose.Words can import list item of a text file as list numbers or plain text in its document object model. The get_DetectNumberingWithWhitespaces() property allows to specify how numbered list items are recognized when a document is imported from plain text format:
The following code example shows how to use this property:
You can control the way of handling leading and trailing spaces during loading TXT file. The leading spaces could be trimmed, preserved or converted to indent and trailing spaces could be trimmed or preserved.
The following code example shows how to trim leading and trailing spaces while importing TXT file:
If you want to export header and footer in output TXT document, you can use the get_ExportHeadersFootersMode() property. This property specifies the way headers and footers are exported to the plain text format.
The following code example shows how to export headers and footers to plain text format:
Aspose.Words introduced the TxtListIndentation class that allows specifying how list levels are indented while exporting to a plain text format. While working with TxtSaveOptions, the get_ListIndentation() property is provided to specify the character to be used for indenting list levels and count specifying how many characters to use as indentation per one list level.
The default value for character property is ‘\0’ indicating that there is no indentation. For count property, the default value is 0 which means no indentation.
The following code example shows how to export list levels using tab characters:
The following code example shows how to export list levels using space characters:
The following code example shows how to export list levels using default indentation:
Q: How can I enable bi‑directional marks when saving a TXT document?
A: Set the set_AddBidiMarks() property of TxtSaveOptions to true before calling Document::Save. This inserts the Unicode RIGHT‑TO‑LEFT MARK (U+200F) before each BiDi run, preserving the correct visual order for Arabic or Hebrew text.
Q: Which option controls the detection of numbered list items when loading a plain‑text file?
A: Use the get_DetectNumberingWithWhitespaces() property of TxtLoadOptions. When set to true, whitespaces are treated as delimiters for list numbers, allowing recognition of Arabic‑style numbering such as “1. 1.2”. Set it to false to rely only on punctuation characters.
Q: How do I trim leading and trailing spaces while importing a TXT file?
A: Configure TxtLoadOptions::set_LeadingSpacesOptions and TxtLoadOptions::set_TrailingSpacesOptions to TxtLeadingSpacesOptions::Trim and TxtTrailingSpacesOptions::Trim respectively. Then load the document with these options; the spaces will be removed during import.
Q: Can headers and footers be exported to a plain‑text file?
A: Yes. Call TxtSaveOptions::set_ExportHeadersFootersMode with TxtExportHeadersFootersMode::AllAtEnd (or TxtExportHeadersFootersMode::PrimaryOnly) to include header and footer text in the generated TXT output.
Q: How can I customize list indentation when saving to TXT (tabs, spaces, or default)?
A: Get the TxtListIndentation object via TxtSaveOptions::get_ListIndentation(), call TxtListIndentation::set_Character with '\t' for tabs or ' ' for spaces, and TxtListIndentation::set_Count (e.g., 4 for four spaces). If you leave the character as '\0' and count as 0, no indentation is added.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.