使用C++将Smart Art转换为组形状

可能的使用场景

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

将智能图转换为组合形状

以下示例代码加载含有Smart Art形状的示例Excel文件,并将Smart Art形状转换为组形状,打印Shape::IsGroup属性。请查看下面的控制台输出。

todo:image_alt_text

示例代码

#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_GetResultOfSmartArt.xlsx");
    Workbook wb(inputFilePath);

    // Access first worksheet
    Worksheet ws = wb.GetWorksheets().Get(0);

    // Access first shape
    Shape sh = ws.GetShapes().Get(0);

    // Determine if shape is smart art
    std::cout << "Is Smart Art Shape: " << sh.IsSmartArt() << std::endl;

    // Determine if shape is group shape
    std::cout << "Is Group Shape: " << sh.IsGroup() << std::endl;

    // Convert smart art shape into group shape
    std::cout << "Is Group Shape: " << sh.GetResultOfSmartArt().IsGroup() << std::endl;

    Aspose::Cells::Cleanup();
}

控制台输出

Is Smart Art Shape: True

Is Group Shape: False

Is Group Shape: True