Spire.Presentation for Java supports to add numbered lists as well as bulleted lists to PowerPoint document. This article demonstrates how to add a numbered list, a symbol bulleted list and a custom picture bulleted list using Spire.Presentation for Java.
import com.spire.presentation.*; import com.spire.presentation.drawing.FillFormatType; import javax.imageio.ImageIO; import java.awt.*; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.File; public class AddBullets { public static void main(String[] args) throws Exception { //Create a Presentation instance Presentation ppt = new Presentation(); //Get the first slide ISlide slide = ppt.getSlides().get(0); Rectangle2D rect = new Rectangle2D.Double(50, 70, 300, 200); //Append a shape to the slide and set shape style IAutoShape shape = slide.getShapes().appendShape(ShapeType.RECTANGLE, rect); shape.getShapeStyle().getLineColor().setColor(Color.white); shape.getFill().setFillType(FillFormatType.NONE); //Clear the default paragragh shape.getTextFrame().getParagraphs().clear(); String[] str = new String[] {"Item 1", "Item 2", "Item 3" ,"Item 4", "Item 5", "Item 6","Item 7", "Item 8", "Item 9" }; //Add a numbered bulleted list for(int i = 0; i < 3; i ++) { ParagraphEx paragraph = new ParagraphEx(); shape.getTextFrame().getParagraphs().append(paragraph); paragraph.setText(str[i]); paragraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); paragraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); paragraph.setBulletType(TextBulletType.NUMBERED); paragraph.setBulletStyle(NumberedBulletStyle.BULLET_ROMAN_LC_PERIOD); } //Add a symbol bulleted list for(int j = 3; j < 6; j ++) { ParagraphEx paragraph = new ParagraphEx(); shape.getTextFrame().getParagraphs().append(paragraph); paragraph.setText(str[j]); paragraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); paragraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); paragraph.setBulletType(TextBulletType.SYMBOL); } //Add a custom bulleted list with picture for(int k = 6; k < str.length; k ++) { ParagraphEx paragraph = new ParagraphEx(); shape.getTextFrame().getParagraphs().append(paragraph); paragraph.setText(str[k]); paragraph.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID); paragraph.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.black); paragraph.setBulletType(TextBulletType.PICTURE); BufferedImage image = ImageIO.read(new File("timg.jpg")); paragraph.getBulletPicture().setEmbedImage(ppt.getImages().append(image)); } //Save the document ppt.saveToFile("AddBullets.pptx", FileFormat.PPTX_2013); } }