如何将表格(参见下面的代码)插入到 word 文件的特定位置(该位置是段落的文本)。那你可以设置表格单元格的字体和宽度吗?
Dim table As New Table()
Dim tblBorders As New TableBorders()
tblBorders.TopBorder = New TopBorder()
tblBorders.TopBorder.Val = New EnumValue(Of BorderValues)(BorderValues.[Single])
tblBorders.BottomBorder = New BottomBorder()
tblBorders.BottomBorder.Val = New EnumValue(Of BorderValues)(BorderValues.[Single])
tblBorders.LeftBorder = New LeftBorder()
tblBorders.LeftBorder.Val = New EnumValue(Of BorderValues)(BorderValues.[Single])
tblBorders.RightBorder = New RightBorder()
tblBorders.RightBorder.Val = New EnumValue(Of BorderValues)(BorderValues.[Single])
tblBorders.InsideHorizontalBorder = New InsideHorizontalBorder()
tblBorders.InsideHorizontalBorder.Val = BorderValues.[Single]
tblBorders.InsideVerticalBorder = New InsideVerticalBorder()
tblBorders.InsideVerticalBorder.Val = BorderValues.[Single]
tblPr.Append(tblBorders)
table.Append(tblPr)
trnew = New TableRow()
tc = New TableCell(New Paragraph(New Run(New Text("A"))))
trnew.Append(tc)
tc = New TableCell(New Paragraph(New Run(New Text("B"))))
trnew.Append(tc)
tc = New TableCell(New Paragraph(New Run(New Text("C"))))
Dim tcp As New TableCellProperties()
Dim gridSpan As New GridSpan()
gridSpan.Val = 4
tcp.Append(gridSpan)
tc.Append(tcp)
trnew.Append(tc)
tc = New TableCell(New Paragraph(New Run(New Text("D"))))
trnew.Append(tc)
table.Append(trnew)
谢谢!