将智能图转为组合形状
Contents
[
Hide
]
可能的使用场景
您可以使用Shape.getResultOfSmartArt()方法将智能图形转为组合形状。这将使您能够像处理组合形状一样处理智能图形。因此,您将能够访问组合形状的各个部分或形状。
将智能图转换为组合形状
以下示例代码加载了包含智能图形的sample Excel file,如下图所示。然后将智能图形转换为组图形,并打印出Shape.IsGroup属性。请参阅下面给出的示例代码的控制台输出。
示例代码
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_GetResultOfSmartArt.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()); | |
//Determine if shape is group shape | |
System.out.println("Is Group Shape: " + sh.isGroup()); | |
//Convert smart art shape into group shape | |
System.out.println("Is Group Shape: " + sh.getResultOfSmartArt().isGroup()); |
控制台输出
Is Smart Art Shape: true
Is Group Shape: false
Is Group Shape: true