You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Jamie Johnson <je...@gmail.com> on 2012/10/02 15:55:07 UTC
Issue drawing XSLFTable
I used the tutorial at
https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial4.java
to build a power point file with a table (no change to the source) and
then tried to draw that as an image using the code below, but I am not
seeing the table getting drawn to the image, it is simply blank. Can
anyone help me understand why this is not working? Is this a bug or
am I doing something incorrectly? Thanks in advance.
XMLSlideShow ppt = new XMLSlideShow(OPCPackage.open(file));
Dimension pgsize = ppt.getPageSize();
// convert each slide into a .svg file
XSLFSlide[] slide = ppt.getSlides();
for (int i = 0; i < slide.length; i++) {
String title = slide[i].getTitle();
System.out.println("Rendering slide " + (i + 1) + (title
== null ? "" : ": " + title));
BufferedImage image = new BufferedImage(pgsize.width,
pgsize.height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = image.createGraphics();
graphics.setPaint(Color.white);
graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
slide[i].draw(graphics);
ImageIO.write(image, "png", new FileOutputStream(name + "-slide-" +
(i + 1) + ".png"));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Issue drawing XSLFTable
Posted by Jamie Johnson <je...@gmail.com>.
Perfect, just the answer I was looking for!
Is there a plan/timeframe for when this will be available?
On Thu, Oct 4, 2012 at 7:10 AM, Yegor Kozlov <ye...@dinom.ru> wrote:
> XSLF can render only simple shapes. Rendering of complex objects like
> tables and charts is not yet supported.
>
> Yegor
>
> On Tue, Oct 2, 2012 at 5:55 PM, Jamie Johnson <je...@gmail.com> wrote:
>> I used the tutorial at
>> https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial4.java
>> to build a power point file with a table (no change to the source) and
>> then tried to draw that as an image using the code below, but I am not
>> seeing the table getting drawn to the image, it is simply blank. Can
>> anyone help me understand why this is not working? Is this a bug or
>> am I doing something incorrectly? Thanks in advance.
>>
>> XMLSlideShow ppt = new XMLSlideShow(OPCPackage.open(file));
>>
>> Dimension pgsize = ppt.getPageSize();
>>
>> // convert each slide into a .svg file
>> XSLFSlide[] slide = ppt.getSlides();
>> for (int i = 0; i < slide.length; i++) {
>>
>> String title = slide[i].getTitle();
>> System.out.println("Rendering slide " + (i + 1) + (title
>> == null ? "" : ": " + title));
>>
>>
>> BufferedImage image = new BufferedImage(pgsize.width,
>> pgsize.height, BufferedImage.TYPE_INT_RGB);
>>
>> Graphics2D graphics = image.createGraphics();
>> graphics.setPaint(Color.white);
>> graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
>> slide[i].draw(graphics);
>> ImageIO.write(image, "png", new FileOutputStream(name + "-slide-" +
>> (i + 1) + ".png"));
>>
>> }
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Issue drawing XSLFTable
Posted by Yegor Kozlov <ye...@dinom.ru>.
XSLF can render only simple shapes. Rendering of complex objects like
tables and charts is not yet supported.
Yegor
On Tue, Oct 2, 2012 at 5:55 PM, Jamie Johnson <je...@gmail.com> wrote:
> I used the tutorial at
> https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial4.java
> to build a power point file with a table (no change to the source) and
> then tried to draw that as an image using the code below, but I am not
> seeing the table getting drawn to the image, it is simply blank. Can
> anyone help me understand why this is not working? Is this a bug or
> am I doing something incorrectly? Thanks in advance.
>
> XMLSlideShow ppt = new XMLSlideShow(OPCPackage.open(file));
>
> Dimension pgsize = ppt.getPageSize();
>
> // convert each slide into a .svg file
> XSLFSlide[] slide = ppt.getSlides();
> for (int i = 0; i < slide.length; i++) {
>
> String title = slide[i].getTitle();
> System.out.println("Rendering slide " + (i + 1) + (title
> == null ? "" : ": " + title));
>
>
> BufferedImage image = new BufferedImage(pgsize.width,
> pgsize.height, BufferedImage.TYPE_INT_RGB);
>
> Graphics2D graphics = image.createGraphics();
> graphics.setPaint(Color.white);
> graphics.fill(new Rectangle2D.Float(0, 0, pgsize.width, pgsize.height));
> slide[i].draw(graphics);
> ImageIO.write(image, "png", new FileOutputStream(name + "-slide-" +
> (i + 1) + ".png"));
>
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org