简体   繁体   中英

how to change direction and alignment of paragraph to rtl by aspsoe.word for c#.Net

I change alignment of paragraph to right align but when I change direction of paragraph to right to left(by builder.ParagraphFormat.Bidi= true ) my alignment alter to left align.

builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Font.Bidi=true;
builder.Font.LocaleIdBi = 1025;
builder.ParagraphFormat.Bidi= true;

尝试将对齐方式移到Bidi语句之后?

I chnaged

builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;

to

builder.ParagraphFormat.Alignment = ParagraphAlignment.Left

and worked.

Please try using the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Signal to Microsoft Word that this run of text contains right-to-left text.
builder.Font.Bidi = true;
builder.CurrentParagraph.ParagraphFormat.Bidi = true;

builder.Font.LocaleIdBi = 1025;

// Insert some Arabic text.
builder.Writeln("هذا كتاب.");

doc.Save("D:\\Temp\\17.11.docx");

I work with Aspose as Developer Evangelist.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM