poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr.jonze <mr.jo...@gmail.com>
Subject Re: PPT Pictures
Date Tue, 04 Jul 2006 13:54:21 GMT
Hi

I'd like to report an error that i found while using POI. I was retrieving
the pictures from a ppt file and saving each one in a file and it was
working ok, but i deleted one of the pictures of the PowerPoint file and POI
was still saving it in a file. Then I realized that it happens when the
source file of the picture is NOT a .PNG file. In this case, it happened
with a .BMP and a .JPG file.

Any suggestions?

Thanks,
mr_jonze.

2006/7/3, Yegor Kozlov <yegor@dinom.ru>:
>
> Hi
>
> > For instance, if there are 3 pictures, being 2 of them the same picture,
> > the returned vector length is 2.
>
> It's how it is supposed to work. HSLFSlideShow.getPictures() returns the
> actual array of images contained in the presentation.
> Each image is included only once regardless of how many times you have it
> in the slides.
>
>
> > What can I do to get the real images number?
>
> It looks like you need the number of images shapes, not the number of
> actual images contained in the ppt.
>
> See the code:
>
>         SlideShow ppt = new SlideShow(new HSLFSlideShow("images.ppt"));
>
>         //images contained in this slide show
>         PictureData[] pict = ppt.getPictureData();
>
>         //get the number of image shapes
>         int imageCount = 0;
>         Slide[] slide = ppt.getSlides();
>         for (int i = 0; i < slide.length; i++) {
>             Shape[] sh = slide[i].getShapes();
>             for (int j = 0; j < sh.length; j++) {
>                 if (sh[j] instanceof Picture) {
>                     Picture p = (Picture)sh[j];
>                     PictureData pdata = p.getPictureData();
>
>                     imageCount++;
>                 }
>             }
>         }
>
> Since the same image can be placed on several slides imageCount may not
> equal to pict.length.
>
>
> Yegor
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message