DocumentDirection enumeration
DocumentDirection enumeration
Allows to specify the direction to flow the text in a document.
Members
Name | Description |
---|---|
LEFT_TO_RIGHT | Left to right direction. |
RIGHT_TO_LEFT | Right to left direction. |
AUTO | Auto-detect direction. |
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
- module aspose.words.loading