5
我用c#創建一個Word文檔與Microsoft.Office.Interop.Word如何設置文本方向RightToLeft在MS Word文檔在C#中?
我想在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();
是的,但它仍然LeftToRight! –
@ a_ahmadi:我有同樣的問題,您是否找到解決方案? –
我使用這個:wordApp.Selection.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphRight; –