将智能艺术转换为组形

可能的使用场景

您可以使用形状.GetResultOfSmartArt()方法。它将使您能够像处理组形状一样处理智能艺术形状。因此,您将可以访问组形状的各个部分或形状。

将智能艺术转换为组形

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

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

示例代码

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
//Load the sample smart art shape - Excel file
Workbook wb = new Workbook("sampleSmartArtShape_GetResultOfSmartArt.xlsx");
//Access first worksheet
Worksheet ws = wb.Worksheets[0];
//Access first shape
Shape sh = ws.Shapes[0];
//Determine if shape is smart art
Console.WriteLine("Is Smart Art Shape: " + sh.IsSmartArt);
//Determine if shape is group shape
Console.WriteLine("Is Group Shape: " + sh.IsGroup);
//Convert smart art shape into group shape
Console.WriteLine("Is Group Shape: " + sh.GetResultOfSmartArt().IsGroup);

控制台输出

Is Smart Art Shape: True

Is Group Shape: False

Is Group Shape: True