WPS 加载项开发 > 表格 API 参考 > ShapeRange > 方法 > ShapeRange.SetShapesDefaultProperties 方法
将指定形状的格式设置为形状的默认格式。

语法

表达式.SetShapesDefaultProperties

表达式   一个代表 ShapeRange 对象的变量。

示例

此示例向 myDocument 中添加矩形,设置该矩形的填充样式,将矩形的格式设置为该矩形的默认格式,然后在文档中添加另一个较小的矩形。第二个矩形的填充格式与第一个矩形一样。

示例代码
let myDocument = Worksheets.Item(1)
let s = myDocument.Shapes
let a =s.AddShape(msoShapeRectangle, 5, 5, 80, 60)
let f = a.Fill
f.ForeColor.RGB = 0, 0, 255
f.BackColor.RGB = 0, 204, 255
f.Patterned(msoPatternHorizontalBrick)

// Set formatting as default formatting
a.SetShapesDefaultProperties()

// Create new shape with default formatting
s.AddShape(msoShapeRectangle, 90, 90, 40, 30)


请参阅