when create a slide to display some content and bullets, the bullets lost format. public class BulletsDemo { public static void main(String[] args) throws Exception { BulletsDemo bd = new BulletsDemo(); SlideShow ppt = new SlideShow(); Slide slide = ppt.createSlide(); TextBox shape = new TextBox(); bd.normalSlide(shape); bd.bulletSlide(shape); slide.addShape(shape); FileOutputStream out = new FileOutputStream("c:/bullets.ppt"); ppt.write(out); out.close(); } public void bulletSlide(TextBox shape) { String content = "January\rFebruary\rMarch\rApril"; TextRun tr = shape.createTextRun(); RichTextRun rt = tr.appendText(content); rt.setBulletOffset(30); rt.setTextOffset(50); rt.setBulletChar('\u25CF'); rt.setFontSize(18); } public void normalSlide(TextBox shape) { String content = "Apache POI 3.7 Demo\r"; RichTextRun rt = shape.getTextRun().getRichTextRuns()[0]; rt.setText(content); rt.setFontSize(25); } }
This works now as expected and partly fixed as part of #45124 For reference - this is my testcode: public void bug51302() throws IOException { HSLFSlideShow ppt = new HSLFSlideShow(); HSLFSlide slide = ppt.createSlide(); HSLFTextBox shape = slide.createTextBox(); HSLFTextRun tr0 = shape.appendText("Apache POI 3.7 Demo", true); tr0.setFontSize(25d); HSLFTextRun tr1 = shape.appendText("January\u000bFebruary\u000bMarch\u000bApril", true); tr1.setFontSize(18d); HSLFTextParagraph tp = tr1.getTextParagraph(); tp.setBulletStyle('\u25CF', Color.black); tp.setLeftMargin(30d); shape.setAnchor(new Rectangle(100, 100, 400, 500)); FileOutputStream out = new FileOutputStream("bullets.ppt"); ppt.write(out); out.close(); ppt.close(); }