public class DocumentDirection
extends java.lang.Object
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.
TxtLoadOptions loadOptions = new 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.
loadOptions.setDocumentDirection(DocumentDirection.AUTO);
// Detect Hebrew text as right-to-left.
Document doc = new Document(getMyDir() + "Hebrew text.txt", loadOptions);
Assert.assertTrue(doc.getFirstSection().getBody().getFirstParagraph().getParagraphFormat().getBidi());
// Detect English text as right-to-left.
doc = new Document(getMyDir() + "English text.txt", loadOptions);
Assert.assertFalse(doc.getFirstSection().getBody().getFirstParagraph().getParagraphFormat().getBidi());
| Modifier and Type | Field and Description |
|---|---|
static int |
AUTO
Auto-detect direction.
|
static int |
LEFT_TO_RIGHT
Left to right direction.
|
static int |
length |
static int |
RIGHT_TO_LEFT
Right to left direction.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String documentDirectionName) |
static java.lang.String |
getName(int documentDirection) |
static int[] |
getValues() |
static java.lang.String |
toString(int documentDirection) |
public static int LEFT_TO_RIGHT
public static int RIGHT_TO_LEFT
public static int AUTO
Remarks:
When this option is selected and text contains characters belonging to RTL scripts, the document direction will be set automatically to RTL.
public static int length