Vb.net 格式化命令不应用于表中的希伯来文文本

Vb.net 格式化命令不应用于表中的希伯来文文本,vb.net,ms-word,Vb.net,Ms Word,这是用于生成带有表的Word文档的示例代码。 代码运行得很好,但单元格中的希伯来文文本不受“粗体字体”和“对齐”等格式行的影响。同样的代码适用于英语内容 Dim oWord As Word.Application Dim oDoc As Word.Document Dim oTable As Word.Table 'Start Word and open the document template. oWord = CreateObject("Word

这是用于生成带有表的Word文档的示例代码。 代码运行得很好,但单元格中的希伯来文文本不受“粗体字体”和“对齐”等格式行的影响。同样的代码适用于英语内容

    Dim oWord As Word.Application
    Dim oDoc As Word.Document
    Dim oTable As Word.Table


    'Start Word and open the document template.
    oWord = CreateObject("Word.Application")
    oDoc = oWord.Documents.Add


    'Insert a 3 x 5 table, fill it with data, and make the first row
    'bold and italic.
    Dim r As Integer, c As Integer
 oTable = oDoc.Tables.Add(oDoc.Bookmarks.Item("\endofdoc").Range, 3, 5)
    oTable.Range.ParagraphFormat.SpaceAfter = 6
    For r = 1 To 3
        For c = 1 To 5
            oTable.Cell(r, c).Range.Text = "שורה " & r & "עמודה " & c
        Next
    Next
    oTable.TableDirection = Word.WdTableDirection.wdTableDirectionRtl
    oTable.Borders.Enable = 1
    oTable.Rows.Item(1).Range.Font.Bold = True
    oTable.Rows.Item(1).Range.Font.Italic = True
    oTable.Rows.Item(1).Range.ParagraphFormat.Alignment = _
      Word.WdParagraphAlignment.wdAlignParagraphCenter

嗯,这里的格式很好,但是表/文本不是RTL,我不能将语言格式化为希伯来语。我怀疑这可能与UI中的语言设置有关,但我在这方面没有什么经验。我唯一能建议的是在插入表之后立即将RTL命令放在顶部。您还可以尝试应用语言格式:
oTable.Range.LanguageID=wdHebrew
。同时测试您是否能够以用户身份在文档中应用格式。感谢您的重播。感谢您的重播。我刚刚尝试将命令移动到top+语言。仍然无法工作!!我已经测试了不同的PC和Office版本,但仍然无法工作。