document_direction property

TxtLoadOptions.document_direction property

Gets or sets a document direction. The default value is DocumentDirection.LEFT_TO_RIGHT.

@property
def document_direction(self) -> aspose.words.loading.DocumentDirection:
    ...

@document_direction.setter
def document_direction(self, value: aspose.words.loading.DocumentDirection):
    ...

Examples

Shows how to detect plaintext document text direction.

# Create a "TxtLoadOptions" object, which we can pass to a document's constructor
# to modify how we load a plaintext document.
load_options = aw.loading.TxtLoadOptions()
# Set the "DocumentDirection" property to "DocumentDirection.Auto" automatically detects
# the direction of every paragraph of text that Aspose.Words loads from plaintext.
# Each paragraph's "Bidi" property will store its direction.
load_options.document_direction = aw.loading.DocumentDirection.AUTO
# Detect Hebrew text as right-to-left.
doc = aw.Document(file_name=MY_DIR + 'Hebrew text.txt', load_options=load_options)
self.assertTrue(doc.first_section.body.first_paragraph.paragraph_format.bidi)
# Detect English text as right-to-left.
doc = aw.Document(file_name=MY_DIR + 'English text.txt', load_options=load_options)
self.assertFalse(doc.first_section.body.first_paragraph.paragraph_format.bidi)

See Also