How to set the direction of RightToLeft text in a word word document in C #?

I am creating a word document in C # with Microsoft.Office.Interop.Word

I want to display my Arabic text in the rtl direction (RightToLeft). How to set text direction on rtl?

In my code below, I am changing my hug, but I cannot change direction. Please help me!

Word.Application wordApp = new Word.Application();
object objMissing = System.Reflection.Missing.Value;
Word.Document wordDoc = wordApp.Documents.Add(ref objMissing, ref objMissing, ref objMissing, ref objMissing);
Word.Paragraph wordParagraph = wordDoc.Paragraphs.Add(ref objMissing);
wordParagraph.Range.Font.Name = "B Titr";
wordParagraph.Range.Font.Size = 14;
WordParagraph.Range.ParagraphFormat.Alignment =  Word.WdParagraphAlignment.wdAlignParagraphRight;
wordParagraph.Range.Text = "My Arabic text";
wordParagraph.Range.InsertParagraphAfter();
+5
source share
2 answers

Have you tried this?

wordParagraph.ReadingOrder = WdReadingOrder.wdReadingOrderRtl;
+4
source

Try

oDoc.Paragraphs.ReadingOrder = Word.WdReadingOrder.wdReadingOrderRtl;

where oDocis an instanceWord._Document

+4
source

All Articles