用Node.js通过C++确定Shape是否为智能艺术形状
Contents
[
Hide
]
可能的使用场景
智能艺术形状是Microsoft Excel中的特殊形状,允许你自动创建复杂的图表。你可以使用Shape.isSmartArt()属性判断形状是智能艺术形状还是普通形状。
确定形状是否为智能图形
以下示例代码加载包含智能艺术形状的示例Excel文件,如截图所示。然后它打印第一个形状的Shape.isSmartArt()属性值,请查看示例代码控制台输出。
示例代码
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sampleSmartArtShape.xlsx");
// Load the sample smart art shape - Excel file
const workbook = new AsposeCells.Workbook(filePath);
// Access first worksheet
const worksheet = workbook.getWorksheets().get(0);
// Access first shape
const shape = worksheet.getShapes().get(0);
// Determine if shape is smart art
console.log("Is Smart Art Shape: " + shape.isSmartArt());
控制台输出
Is Smart Art Shape: True