You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Yegor Kozlov <ye...@dinom.ru> on 2006/07/04 16:06:14 UTC

Re[2]: PPT Pictures

Hi

Attach the bad ppt and we will see what is wrong.
Also I would like to see the code which saves ppt images.

Yegor

mj> Hi

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

mj> Any suggestions?

mj> Thanks,
mj> mr_jonze.

mj> 2006/7/3, Yegor Kozlov <ye...@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/
>>
>>


---------------------------------------------------------------------
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/