[prev in list] [next in list] [prev in thread] [next in thread] 

List:       poi-user
Subject:    Re: Create XSLF Table - What am I doing wrong?
From:       Andreas Beeker <kiwiwings () apache ! org>
Date:       2018-05-16 20:00:07
Message-ID: 83fbde06-db4c-d62e-968b-0a0e19ec1a6b () apache ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]

[Attachment #4 (multipart/alternative)]


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); }


[Attachment #7 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 5/15/18 4:20 PM, sai0276 wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1526394053815-0.post@n5.nabble.com">
      <pre class="moz-quote-pre" wrap="">I have the same problem.

Did it get resolved by any chance.
</pre>
    </blockquote>
    <p>Yes ... I haven't checked when, but I think it was something
      related to XmlBeans loading.</p>
    <p>Just use POI 3.17 and the below code works.<br>
    </p>
    <p><br>
    </p>
    <p>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Can help me here.</pre>
      </blockquote>
      I'm sure you can :)</p>
    <p><br>
    </p>
    <p>Andi<br>
    </p>
    <p><br>
    </p>
    <pre style="background-color:#2b2b2b;color:#a9b7c6;font-family:'DejaVu Sans \
Mono';font-size:22.5pt;"><span style="color:#cc7832;">try </span>(XMLSlideShow \
slideshow = <span style="color:#cc7832;">new </span>XMLSlideShow()<span \
style="color:#cc7832;">; </span><span style="color:#cc7832;">     \
</span>FileOutputStream fos = <span style="color:#cc7832;">new \
</span>FileOutputStream(<span style="color:#6a8759;">"bla.pptx"</span>)) {  XSLFSlide \
slide = slideshow.createSlide()<span style="color:#cc7832;">; </span><span \
style="color:#cc7832;">    </span>XSLFTable newTable = slide.createTable(<span \
style="color:#6897bb;">3</span><span style="color:#cc7832;">, </span><span \
style="color:#6897bb;">3</span>)<span style="color:#cc7832;">; </span><span \
style="color:#cc7832;">    </span>newTable.setAnchor(<span style="color:#cc7832;">new \
</span>Rectangle(<span style="color:#6897bb;">100</span><span \
style="color:#cc7832;">, </span><span style="color:#6897bb;">100</span><span \
style="color:#cc7832;">, </span><span style="color:#6897bb;">100</span><span \
style="color:#cc7832;">, </span><span style="color:#6897bb;">100</span>))<span \
style="color:#cc7832;">; </span><span style="color:#cc7832;">
</span><span style="color:#cc7832;">    </span>XSLFTableRow tableRow = \
newTable.addRow()<span style="color:#cc7832;">; </span><span style="color:#cc7832;">  \
</span>XSLFTableCell cell = tableRow.addCell()<span style="color:#cc7832;">; \
</span><span style="color:#cc7832;">    </span>XSLFTextParagraph textparagraph = \
cell.addNewTextParagraph()<span style="color:#cc7832;">; </span><span \
style="color:#cc7832;">    </span>XSLFTextRun textrun = \
textparagraph.addNewTextRun()<span style="color:#cc7832;">; </span><span \
style="color:#cc7832;">    </span>textrun.setText(<span style="color:#6a8759;">"Any \
Text"</span>)<span style="color:#cc7832;">; </span><span style="color:#cc7832;">    \
</span>textrun.setFontColor(Color.<span \
style="color:#9876aa;font-style:italic;">BLUE</span>)<span style="color:#cc7832;">; \
</span><span style="color:#cc7832;">    \
</span>textparagraph.setTextAlign(TextParagraph.TextAlign.<span \
style="color:#9876aa;font-style:italic;">CENTER</span>)<span style="color:#cc7832;">; \
</span><span style="color:#cc7832;">    </span>tableRow.addCell()<span \
style="color:#cc7832;">; </span><span style="color:#cc7832;">    \
</span>tableRow.addCell()<span style="color:#cc7832;">; </span><span \
style="color:#cc7832;">    </span>tableRow.mergeCells(<span \
style="color:#6897bb;">0</span><span style="color:#cc7832;">, </span><span \
style="color:#6897bb;">1</span>)<span style="color:#cc7832;">; </span><span \
style="color:#cc7832;"> </span><span style="color:#cc7832;">    new \
</span>DrawTableShape(newTable).setAllBorders(<span \
style="color:#6897bb;">3.</span><span style="color:#cc7832;">, \
</span>StrokeStyle.LineDash.<span \
style="color:#9876aa;font-style:italic;">LG_DASH_DOT</span><span \
style="color:#cc7832;">, </span>Color.<span \
style="color:#9876aa;font-style:italic;">BLUE</span>)<span style="color:#cc7832;">; \
</span><span style="color:#cc7832;"> </span><span style="color:#cc7832;">    \
</span>slideshow.write(fos)<span style="color:#cc7832;">; </span>}</pre>
  </body>
</html>


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic