// Check if shape is of SmartArt type
if (shape instanceof ISmartArt)
{
// Typecast shape to SmartArtEx
ISmartArt smart = (ISmartArt) shape;
if (smart.getAllNodes().getCount() > 0)
{
// Accessing SmartArt node at index 0
ISmartArtNode node = smart.getAllNodes().get_Item(0);
// Removing the selected node
smart.getAllNodes().removeNode(node);
}
}
}
// Save Presentation
pres.save("data/AsposeRemoveSmartArtNode.pptx", SaveFormat.Pptx);
//============================================
// Removing Smart Art from Specific Location
//============================================
// Load the desired the presentation
Presentation pres1 = new Presentation(
"data/AsposeAddSmartArtNodeByPosition.pptx");
// Traverse through every shape inside first slide
for (IShape shape : pres1.getSlides().get_Item(0).getShapes())
{
// Check if shape is of SmartArt type
if (shape instanceof SmartArt)
{
// Typecast shape to SmartArt
SmartArt smart = (SmartArt) shape;
if (smart.getAllNodes().getCount() > 0)
{
// Accessing SmartArt node at index 0
ISmartArtNode node = smart.getAllNodes().get_Item(0);
if (node.getChildNodes().getCount() >= 2)
{
// Removing the child node at position 1
((SmartArtNodeCollection) node.getChildNodes())