DocumentDirection

DocumentDirection enumeration

Ermöglicht die Angabe der Textflussrichtung in einem Dokument.

public enum DocumentDirection

Werte

NameWertBeschreibung
LeftToRight0Von links nach rechts.
RightToLeft1Von rechts nach links.
Auto2Richtung automatisch erkennen.

Beispiele

Zeigt, wie die Textrichtung in Klartextdokumenten erkannt wird.

// Erstelle ein "TxtLoadOptions"-Objekt, das wir an den Konstruktor eines Dokuments übergeben können
// um zu ändern, wie wir ein Klartextdokument laden.
TxtLoadOptions loadOptions = new TxtLoadOptions();

// Setzen Sie die Eigenschaft "DocumentDirection" auf "DocumentDirection.Auto" erkennt automatisch
// die Richtung jedes Textabsatzes, den Aspose.Words aus dem Klartext lädt.
// Die „Bidi“-Eigenschaft jedes Absatzes speichert seine Richtung.
loadOptions.DocumentDirection = DocumentDirection.Auto;

// Hebräischen Text als von rechts nach links lesend erkennen.
Document doc = new Document(MyDir + "Hebrew text.txt", loadOptions);

Assert.True(doc.FirstSection.Body.FirstParagraph.ParagraphFormat.Bidi);

// Englischen Text als von rechts nach links lesend erkennen.
doc = new Document(MyDir + "English text.txt", loadOptions);

Assert.False(doc.FirstSection.Body.FirstParagraph.ParagraphFormat.Bidi);

Siehe auch