将智能艺术转换为组形

可能的使用场景

您可以使用[形状.getResultOfSmartArt()](https://reference.aspose.com/cells/java/com.aspose.cells/shape#getResultOfSmartArt()) 方法。它将使您能够像处理组形状一样处理智能艺术形状。因此,您将可以访问组形状的各个部分或形状。

将智能艺术转换为组形

下面的示例代码加载示例 Excel 文件包含智能艺术形状,如此屏幕截图所示。然后它将智能艺术形状转换为组形状并打印形状.IsGroup财产。请查看下面给出的示例代码的控制台输出。

待办事项:图片_替代_文本

示例代码

// 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