Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
vb.net创建word表格并对齐行和文本_Vb.net - Fatal编程技术网

vb.net创建word表格并对齐行和文本

vb.net创建word表格并对齐行和文本,vb.net,Vb.net,我正在使用以下代码在word文档中创建一个表: 'create the table oDoc_detail_table = oDoc_detail.Tables.Add(oDoc_detail.Bookmarks.Item("\endofdoc").Range, 1, 6) 'align the table in the center oDoc_detail_table.Rows.Alignment = word.WdRowAlignment.wdAlignRowCenter 'set styl

我正在使用以下代码在word文档中创建一个表:

'create the table
oDoc_detail_table = oDoc_detail.Tables.Add(oDoc_detail.Bookmarks.Item("\endofdoc").Range, 1, 6)
'align the table in the center
oDoc_detail_table.Rows.Alignment = word.WdRowAlignment.wdAlignRowCenter
'set styles
oDoc_detail_table.Range.Font.Name = "Calibri"
oDoc_detail_table.Range.Font.Size = 8
'set width for columns
oDoc_detail_table.Cell(1, 1).Width = 80
oDoc_detail_table.Cell(1, 2).Width = 30
oDoc_detail_table.Cell(1, 3).Width = 330
oDoc_detail_table.Cell(1, 4).Width = 60
oDoc_detail_table.Cell(1, 5).Width = 60
oDoc_detail_table.Cell(1, 6).Width = 40
我希望能够设置表中所有行的高度(我在代码中动态添加行)

另外,我希望垂直对齐在中心


如何在代码中执行此操作?

在添加新行时,是否尝试过设置height属性?是否有理由在添加所有行后设置它们的高度

如果是,您是否尝试过设置循环?这应该在循环执行后快速执行,例如:

For each r as Row in oDoc_detail_table.Rows
  r.Height = 100
Next r

它不必是一旦他们被设置好了-当他们被添加的时候,就可以按添加的方式来做了,这就是oDoc_detail_table.Rows.Height=100在那个循环中,我会使行变暗吗?