ExcelScript.Image interface
表示工作表中的图像。 若要获取相应的 Shape
对象,请使用 Image.getShape
。
注解
示例
/**
* This script transfers an image from one worksheet to another.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the worksheet with the image on it.
const firstWorksheet = workbook.getWorksheet("FirstSheet");
// Get the first image from the worksheet.
// If a script added the image, you could add a name to make it easier to find.
let image: ExcelScript.Image;
firstWorksheet.getShapes().forEach((shape, index) => {
if (shape.getType() === ExcelScript.ShapeType.image) {
image = shape.getImage();
return;
}
});
// Copy the image to another worksheet.
image.getShape().copyTo("SecondSheet");
}
方法
get |
返回图像的格式。 |
get |
指定图像对象的形状标识符。 |
get |
返回与 |
方法详细信息
getFormat()
getId()
指定图像对象的形状标识符。
getId(): string;
返回
string