确定形状是否为智能图形
Contents
[
Hide
]
可能的使用场景
智能图形是微软Excel中的特殊图形,可以自动创建复杂的图表。您可以使用 Shape.IsSmartArt 属性来确定图形是否为智能图形或普通图形。
确定形状是否为智能图形
以下示例代码加载包含智能图形的 示例Excel文件,如下面的屏幕截图所示。然后打印第一个图形的 Shape.IsSmartArt 属性的值。请查看下面给出的示例代码的控制台输出。
示例代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load the sample smart art shape - Excel file | |
Workbook wb = new Workbook("sampleSmartArtShape.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access first shape | |
Shape sh = ws.getShapes().get(0); | |
//Determine if shape is smart art | |
System.out.println("Is Smart Art Shape: " + sh.isSmartArt()); |
控制台输出
Is Smart Art Shape: true