group.setAnchor(bounds); group.setInteriorAnchor(new Rectangle(0, 0, 100, 100)); slide.addShape(group); Graphics2D graphics = new PPGraphics2D(group);
/** * Create a <code>TextBox</code> object that represents the slide's title. * * @return <code>TextBox</code> object that represents the slide's title. */ public HSLFTextBox addTitle() { HSLFPlaceholder pl = new HSLFPlaceholder(); pl.setShapeType(ShapeType.RECT); pl.setPlaceholder(Placeholder.TITLE); pl.setRunType(TextHeaderAtom.TITLE_TYPE); pl.setText("Click to edit title"); pl.setAnchor(new java.awt.Rectangle(54, 48, 612, 90)); addShape(pl); return pl; }
public static void main(String[] args) throws IOException { try (HSLFSlideShow ppt = new HSLFSlideShow()) { HSLFSlide slide = ppt.createSlide(); HSLFTextBox shape = new HSLFTextBox(); HSLFTextParagraph rt = shape.getTextParagraphs().get(0); rt.getTextRuns().get(0).setFontSize(42d); rt.setBullet(true); rt.setIndent(0d); //bullet offset rt.setLeftMargin(50d); //text offset (should be greater than bullet offset) rt.setBulletChar('\u263A'); //bullet character shape.setText( "January\r" + "February\r" + "March\r" + "April"); slide.addShape(shape); shape.setAnchor(new java.awt.Rectangle(50, 50, 500, 300)); //position of the text box in the slide slide.addShape(shape); try (FileOutputStream out = new FileOutputStream("bullets.ppt")) { ppt.write(out); } } } }