用C++判断Shape是否为Smart Art Shape
Contents
[
Hide
]
可能的使用场景
智能图形是Microsoft Excel中特殊的形状,允许您自动生成复杂的图表。使用Shape.IsSmartArt属性可以确定该形状是智能图形还是常规图形。
确定形状是否为智能图形
以下示例代码加载包含智能图形的sample Excel文件,如下图所示。然后打印第一个形状的Shape.IsSmartArt属性的值。请参阅下面提供的示例代码的控制台输出。
示例代码
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
using namespace Aspose::Cells::Drawing;
int main()
{
Aspose::Cells::Startup();
// Load the sample smart art shape - Excel file
U16String inputFilePath(u"sampleSmartArtShape.xlsx");
Workbook wb(inputFilePath);
// Access first worksheet
WorksheetCollection sheets = wb.GetWorksheets();
Worksheet ws = sheets.Get(0);
// Access first shape
ShapeCollection shapes = ws.GetShapes();
Shape sh = shapes.Get(0);
// Determine if shape is smart art
std::cout << "Is Smart Art Shape: " << sh.IsSmartArt() << std::endl;
Aspose::Cells::Cleanup();
}
控制台输出
Is Smart Art Shape: True