Discussion:
Create XSLF Table - What am I doing wrong?
wirthi
2012-04-27 16:18:24 UTC
Permalink
Hi!
I'm quite new in POI and I want to create a XSLFTable but it does not work
properly. There is a cell shown in the powerpoint document but it is totally
unstyled and doesn't have any text in it.

Here my code:

XMLSlideShow slideshow = new XMLSlideShow();
XSLFSlide slide = slideshow.createSlide();
XSLFTable newTable = slide.createTable();
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(TextAlign.CENTER);

Any ideas?

Regards
Wirthi

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5670738.html
Sent from the POI - User mailing list archive at Nabble.com.
wirthi
2012-04-30 14:28:20 UTC
Permalink
No one?
Has anybody already created a working TFLSTable and could post the code
here? Would be very helpful for me. Thank you!

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5676066.html
Sent from the POI - User mailing list archive at Nabble.com.
Yegor Kozlov
2012-05-02 06:51:30 UTC
Permalink
Have a look at this example:

https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial4.java


Yegor
Post by wirthi
No one?
Has anybody already created a working TFLSTable and could post the code
here? Would be very helpful for me. Thank you!
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5676066.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
wirthi
2012-05-02 08:52:50 UTC
Permalink
Thanks! I'm going to try this asap.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5679973.html
Sent from the POI - User mailing list archive at Nabble.com.
wirthi
2012-05-02 10:58:30 UTC
Permalink
Alright, I've just tested it and copied your source code but the problem is
still the same. There is no proper table. Just one empty, unstyled cell.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5680196.html
Sent from the POI - User mailing list archive at Nabble.com.
Yegor Kozlov
2012-05-02 11:10:19 UTC
Permalink
Post by wirthi
Alright, I've just tested it and copied your source code but the problem is
still the same. There is no proper table. Just one empty, unstyled cell.
Are you sure?
Did you modify the source code ? If yes, what exactly did you change?

I ran the example and the resulting pptx looks OK in PowerPoint 2010.
The table is there is all cells are in place.

Yegor
Post by wirthi
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5680196.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
wirthi
2012-05-02 11:21:50 UTC
Permalink
I didn't modify anything. I just copy-pasted the example code and executed
it. I'm using PowerPoint 2010 64bit.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5680228.html
Sent from the POI - User mailing list archive at Nabble.com.
Yegor Kozlov
2012-05-02 11:29:57 UTC
Permalink
Put poi-examples.jar in the classpath and run
org.apache.poi.xslf.usermodel.Tutorial4
What is the result?

Yegor
Post by wirthi
I didn't modify anything. I just copy-pasted the example code and executed
it. I'm using PowerPoint 2010 64bit.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5680228.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
wirthi
2012-05-02 16:28:50 UTC
Permalink
I'm quite busy with other things at the moment so I'm gonna test this
tomorrow or on Friday. I really appreciate your help!

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5681027.html
Sent from the POI - User mailing list archive at Nabble.com.
soulman
2012-05-04 11:23:48 UTC
Permalink
I have the same problem with the empty cell unformatted. I tried executing
the Tutorial 4 but it generates the same contents :S

Any other approach?

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Create-XSLF-Table-What-am-I-doing-wrong-tp5670738p5685566.html
Sent from the POI - User mailing list archive at Nabble.com.
sai0276
2018-05-15 14:20:53 UTC
Permalink
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-***@poi.apache.org
For additional commands, e-mail: user-***@poi.apache.org
Andreas Beeker
2018-05-16 20:00:07 UTC
Permalink
Post by sai0276
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.
Post by sai0276
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); }
Loading...