Table of contents

Cell.BorderDiagonal 属性 (发布服务器)Cell.BorderDiagonal Property (Publisher)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

返回一个CellBorder对象,该对象代表指定的表格单元格的对角线边框。Returns a CellBorderobject that represents the diagonal border for a specified table cell.


表达式BorderDiagonalexpression. BorderDiagonal

表示单元格对象的 _expression_A 变量。_expression_A variable that represents a Cell object.

返回值Return Value



本示例将指定表格中的单元格每隔一个沿对角线进行拆分,并添加对角线边框。本示例假定第二页上的第一个形状是表格而不是其他类型的形状。This example diagonally splits every other cell in the specified table and adds a diagonal border. This example assumes the first shape on page two is a table and not another type of shape.

Sub FillCellsByRow() 
 Dim shpTable As Shape 
 Dim rowTable As Row 
 Dim celTable As Cell 
 Dim intCell As Integer 

 intCell = 1 

 Set shpTable = ActiveDocument.Pages(2).Shapes(1) 
 For Each rowTable In shpTable.Table.Rows 
 For Each celTable In rowTable.Cells 
 If intCell Mod 2 = 0 Then 
 With celTable 
 .Diagonal = pbTableCellDiagonalDown 
 With .BorderDiagonal 
 .Weight = 1 
 .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0) 
 End With 
 End With 
 celTable.Fill.ForeColor.RGB = RGB _ 
 (Red:=180, Green:=180, Blue:=180) 
 celTable.Fill.ForeColor.RGB = RGB _ 
 (Red:=255, Green:=255, Blue:=255) 
 End If 
 intCell = intCell + 1 
 Next celTable 
 Next rowTable 

End Sub
© 2018 Microsoft