java - How to create PPTX when using POI XSLF? -
when create pptx poi xslf blank slide:
xmlslideshow ppt = new xmlslideshow(); xslfslide slide = ppt.createslide(); xslftextbox shape = slide.createtextbox(); xslftextparagraph p = shape.addnewtextparagraph(); xslftextrun r1 = p.addnewtextrun(); r1.settext("the"); r1.setfontcolor(color.blue); r1.setfontsize(24); outputstream out = new fileoutputstream("d:/font.pptx"); ppt.write(out); out.close(); why slide blank without text?
your text box has no anchor (position , size).
you can check examples of poi how add text box: xslf examples - tutorial 6
xslftextbox shape = slide.createtextbox(); shape.setanchor(new rectangle(x, y, width, height));
Comments
Post a Comment