Range.BorderAround(Object, XlBorderWeight, XlColorIndex, Object) 方法

定义

向区域添加边框并设置 Color新边框的 、 LineStyleWeight 属性。

public object BorderAround (object LineStyle, Microsoft.Office.Interop.Excel.XlBorderWeight Weight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlThin, Microsoft.Office.Interop.Excel.XlColorIndex ColorIndex = Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexAutomatic, object Color);
Public Function BorderAround (Optional LineStyle As Object, Optional Weight As XlBorderWeight = Microsoft.Office.Interop.Excel.XlBorderWeight.xlThin, Optional ColorIndex As XlColorIndex = Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexAutomatic, Optional Color As Object) As Object

参数

LineStyle
Object

可选 XlLineStyle。 边框的线条样式。 可以是以下 XlLineStyle 常量之一:xlContinuousdefaultxlDashxlDashDotxlDashDotxlDotxlDot xlDoublexlLineStlyeNonexlSlantDashDotxlLineStlyeNone

Weight
XlBorderWeight

可选 XlBorderWeight。 边框粗细。 可以是以下 XlBorderWeight 常量之一:xlHairlinexlMediumxlThickxlThindefault

ColorIndex
XlColorIndex

可选 XlColorIndex。 边框颜色,作为当前调色板的索引或作为 XlColorIndex 常量。 可以是以下 XlColorIndex 常量之一:xlColorIndexAutomaticdefaultxlColorIndexNone

Color
Object

可选 对象。 边框颜色,以 RGB 值表示。

返回

注解

必须指定 或 Color,但不能同时指定ColorIndex两者。

可以指定 或 Weight,但不能同时指定LineStyle两者。 如果未指定任何参数,Microsoft Excel 将使用默认的线型和粗细。

此方法概述整个区域,而不进行填充。 若要设置所有单元格的边框,必须设置 ColorBorders 集合的 、 LineStyleWeight 属性。 若要清除边框,必须将区域中的所有单元格的 LineStyle 属性设置为 xlLineStyleNone

适用于