You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by sai0276 <sa...@gmail.com> on 2018/05/15 14:20:53 UTC

Re: Create XSLF Table - What am I doing wrong?

I have the same problem.

Did it get resolved by any chance. Can help me here.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Create XSLF Table - What am I doing wrong?

Posted by Andreas Beeker <ki...@apache.org>.
On 5/15/18 4:20 PM, sai0276 wrote:
> I have the same problem.
>
> Did it get resolved by any chance.

Yes ... I haven't checked when, but I think it was something related to XmlBeans loading.

Just use POI 3.17 and the below code works.


> Can help me here.
I'm sure you can :)


Andi


try (XMLSlideShow slideshow = new XMLSlideShow(); FileOutputStream fos = new FileOutputStream("bla.pptx")) {
    XSLFSlide slide = slideshow.createSlide(); XSLFTable newTable = slide.createTable(3, 3); newTable.setAnchor(new Rectangle(100, 100, 100, 100)); XSLFTableRow tableRow = newTable.addRow(); XSLFTableCell cell = tableRow.addCell(); XSLFTextParagraph textparagraph = cell.addNewTextParagraph(); XSLFTextRun textrun = textparagraph.addNewTextRun(); textrun.setText("Any Text"); textrun.setFontColor(Color.BLUE); textparagraph.setTextAlign(TextParagraph.TextAlign.CENTER); tableRow.addCell(); tableRow.addCell(); tableRow.mergeCells(0, 1); new DrawTableShape(newTable).setAllBorders(3., StrokeStyle.LineDash.LG_DASH_DOT, Color.BLUE); slideshow.write(fos); }