Setting Fill Format for SmartArt Node using Aspose.Slides

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:

  1. Create an instance of the Presentation class.
  2. Obtain the reference of a slide using its index.
  3. Add a SmartArt shape by setting its LayoutType.
  4. Set the FillFormat for the SmartArt shape nodes.
  5. 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