格式设置命令不适用于表格中的希伯来语文本



这是生成带有表格的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

尝试oTable.Rows.Item(1).Range.Font.BoldBi

而不是oTable.Rows.Item(1).Range.Font.Bold

最新更新