Setting Fill Format for SmartArt Node using Aspose.Slides
Contents
[
Hide
]
Aspose.Slides - Setting Fill Format for SmartArt Shapes
Aspose.Slides for Java provides a simple API for creating SmartArt shapes and set their node fill format. Please follow the steps below:
- Create an instance of the Presentation class.
- Obtain the reference of a slide using its index.
- Add a SmartArt shape by setting its LayoutType.
- Set the FillFormat for the SmartArt shape nodes.
- Write the modified presentation as a PPTX file.
Java
//Instantiate the presentation
Presentation pres = new Presentation();
//Accessing the slide
ISlide slide = pres.getSlides().get_Item(0);
//Adding SmartArt shape and nodes
ISmartArt chevron = slide.getShapes().addSmartArt(10, 10, 800, 60, com.aspose.slides.SmartArtLayoutType.ClosedChevronProcess);
ISmartArtNode node = chevron.getAllNodes().addNode();
node.getTextFrame().setText("Some text");
//Setting node fill color
for (IShape item : node.getShapes())
{
item.getFillFormat().setFillType(FillType.Solid);
item.getFillFormat().getSolidFillColor().setColor(Color.RED);
}
//Save the presentation
pres.save(dataDir + "AsposeTestSmart.pptx", SaveFormat.Pptx);
Download Running Code
Download Sample Code
For more details, visit Setting Fill Format For SmartArt Node.