Skip to main content

Shape

Shape

返回一个形状对象

方法

getImageDataURL

获取当前形状转换为图片后的dataURL

语法

shape.getImageDataURL()

shape: 形状对象

返回值

Promise<string>

示例

async function example() {
// 活动工作簿
const activeWorkbook = await Application.ActiveWorkbook;
// 活动工作表
const activeSheet = await activeWorkbook.getActiveSheet();
// 形状集合对象
const shapes = await activeSheet.Shapes;
// 获取一个形状对象
const shape = await shapes.item(1);
// 获取当前形状转换为图片后的dataURL
const imageDataURL = await shape.getImageDataURL();
console.log(imageDataURL);
}