Checking Assistant Nodes in SmartArt Shapes using Aspose.Slides
Contents
[
Hide
]
Aspose.Slides - Checking Assistant Nodes in SmartArt Shapes
In the following sample code we will investigate how to identify Assistant Nodes in the SmartArt nodes collection and changing them.
- Create an instance of Presentation class and load the presentation with SmartArt Shape
- Obtain the reference of second slide by using its Index
- Traverse through every shape inside first slide
- Check if shape is of SmartArt type and Typecast selected shape to SmartArt if it is SmartArt
- Traverse through all nodes inside SmartArt shape and check if they are Assistant Nodes
- Change the status of Assistant Node to normal node
- Save the Presentation
Java
// Creating a presentation instance
Presentation pres = new Presentation(dataDir + "presentation.pptx");
// Traverse through every shape inside first slide
for (IShape shape : pres.getSlides().get_Item(0).getShapes())
{
// Check if shape is of SmartArt type
if (shape instanceof ISmartArt)
{
// Typecast shape to SmartArtEx
ISmartArt smart = (SmartArt) shape;
// Traversing through all nodes of SmartArt shape
for (int i = 0; i < smart.getAllNodes().size(); i++)
{
ISmartArtNode node = smart.getAllNodes().get_Item(i);
String tc = node.getTextFrame().getText();
// Check if node is Assistant node
if (node.isAssistant())
{
System.out.println(tc + " - true");
// Setting Assistant node to false and making it normal
// node
node.setAssistant(false);
}
else
{
System.out.println(tc + " - false");
}
}
}
}
// Save Presentation
pres.save(dataDir + "AsposeChangeAssitantNode.pptx", SaveFormat.Pptx);
Download Running Code
Download Sample Code
For more details, visit Checking Assistant Nodes In SmartArt Shapes.