确定形状是否为智能图形
Contents
[
Hide
]
可能的使用场景
智能图形是Microsoft Excel中特殊的形状,允许您自动生成复杂的图表。使用Shape.IsSmartArt属性可以确定该形状是智能图形还是常规图形。
确定形状是否为智能图形
以下示例代码加载包含智能图形的sample 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-.NET | |
//Load the sample smart art shape - Excel file | |
Workbook wb = new Workbook("sampleSmartArtShape.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); |
控制台输出
Is Smart Art Shape: True