poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <ye...@dinom.ru>
Subject Re: PPT Pictures
Date Mon, 03 Jul 2006 07:40:27 GMT

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


Since the same image can be placed on several slides imageCount may not equal to pict.length.


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/

View raw message