我使用Microsoft.Office.Interop.Word
在c#中创建一个word文档我希望在rtl(RightToLeft)方向显示我的阿拉伯文字。如何将文本方向设置为rtl?
在我的下面的代码中,我改变了Alighnment,但我无法改变方向。请帮帮我!
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();
答案 0 :(得分:4)
你试过这个吗?
wordParagraph.ReadingOrder = WdReadingOrder.wdReadingOrderRtl;
答案 1 :(得分:4)
尝试
oDoc.Paragraphs.ReadingOrder = Word.WdReadingOrder.wdReadingOrderRtl;
其中oDoc
是Word._Document
个实例