ExcelScript.Placement enum
指定对象附加到其下层单元格的方式。
注解
示例
/**
* This script creates a diamond shape at cell C3.
* The shape moves and resizes as the grid underneath it changes.
*/
function main(workbook: ExcelScript.Workbook) {
// Get cell C3 in the current worksheet.
const sheet = workbook.getActiveWorksheet();
const cell = sheet.getRange("C3");
// Create a diamond that slightly overlaps the cell C3.
const diamond = sheet.addGeometricShape(ExcelScript.GeometricShapeType.diamond);
// Set each dimension so that the shape extends 5 pixels beyond the cell borders.
diamond.setLeft(cell.getLeft() - 5);
diamond.setTop(cell.getTop() - 5);
diamond.setHeight(cell.getHeight() + 10);
diamond.setWidth(cell.getWidth() + 10);
// Set the placement of the shape so that it resizes and moves with the grid.
diamond.setPlacement(ExcelScript.Placement.twoCell);
}
字段
absolute | 对象是自由浮动的。 |
oneCell | 对象随单元格一起移动。 |
twoCell | 对象随单元格一起移动和调整大小。 |