将智能图转为组合形状

可能的使用场景

您可以使用Shape.GetResultOfSmartArt()方法将智能图形转为组合形状。这将使您能够像处理组合形状一样处理智能图形。因此,您将能够访问组合形状的各个部分或形状。

将智能图转换为组合形状

以下示例代码加载包含智能图形的sample Excel文件,如下图所示。然后将智能图形转为组合形状,并打印Shape.IsGroup属性。请参阅下面提供的示例代码的控制台输出。

todo:image_alt_text

示例代码

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