You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Mathieu Grosmaire <ma...@gmail.com> on 2008/05/29 15:39:51 UTC
HSLF multiple image insertion
Hello
I want to insert the same image on several slides, but it works only on the
first slide.
For the others I've got a red cross.
Here a sample code :
SlideShow ppt = new SlideShow();
Slide s = ppt.createSlide();
Slide s2 = ppt.createSlide();
Slide s3 = ppt.createSlide();
int idx = ppt.addPicture(new File("image.jpg"), Picture.JPEG);
Picture pict = new Picture(idx);
Picture pict2 = new Picture(idx);
Picture pict3 = new Picture(idx);
pict.setAnchor(new Rectangle(10,10,100,100));
s.addShape(pict);
pict2.setAnchor(new Rectangle(10,10,100,100));
s2.addShape(pict2);
pict3.setAnchor(new Rectangle(10,10,100,100));
s3.addShape(pict3);
FileOutputStream out = new FileOutputStream("report.ppt");
ppt.write(out);
out.close();
Thanks
MG
--
View this message in context: http://www.nabble.com/HSLF-multiple-image-insertion-tp17536146p17536146.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: HSLF multiple image insertion
Posted by Yegor Kozlov <ye...@dinom.ru>.
The problem fixed in r664490.
Regards,
Yegor
> Hello
>
> I want to insert the same image on several slides, but it works only on the
> first slide.
> For the others I've got a red cross.
>
> Here a sample code :
>
> SlideShow ppt = new SlideShow();
>
> Slide s = ppt.createSlide();
> Slide s2 = ppt.createSlide();
> Slide s3 = ppt.createSlide();
>
> int idx = ppt.addPicture(new File("image.jpg"), Picture.JPEG);
> Picture pict = new Picture(idx);
> Picture pict2 = new Picture(idx);
> Picture pict3 = new Picture(idx);
>
> pict.setAnchor(new Rectangle(10,10,100,100));
> s.addShape(pict);
>
>
> pict2.setAnchor(new Rectangle(10,10,100,100));
> s2.addShape(pict2);
>
>
> pict3.setAnchor(new Rectangle(10,10,100,100));
> s3.addShape(pict3);
>
> FileOutputStream out = new FileOutputStream("report.ppt");
> ppt.write(out);
> out.close();
>
> Thanks
>
> MG
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re[2]: HSLF multiple image insertion
Posted by Yegor Kozlov <ye...@dinom.ru>.
Looks like some attributes required by PPT 2007 are missing. I will
look into it.
> I try to obtain different idx for the same image but it does not work. It is
> the same idx.
> for example :
> int idx1 = ppt.addPicture(new File("image.jpg"), Picture.JPEG);
> int idx2 = ppt.addPicture(new File("image.jpg"), Picture.JPEG);
> Picture pict = new Picture(idx1);
> Picture pict2 = new Picture(idx2);
This behavior is correct. PowerPoint caches images and addPicture
returns the same idx for the same image.
Yegor
> MG
> Yegor Kozlov wrote:
>>
>> Your code works for me. I tested in PowerPoint 2003 and OpenOffice 2.2
>> and the images are in place.
>>
>> Which version of PowerPoint you are using? Anything special with the
>> image file?
>>
>> Yegor
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: HSLF multiple image insertion
Posted by Mathieu Grosmaire <ma...@gmail.com>.
Thanks a lot
You are alright, the problem comes from office 2007.
I try to obtain different idx for the same image but it does not work. It is
the same idx.
for example :
int idx1 = ppt.addPicture(new File("image.jpg"), Picture.JPEG);
int idx2 = ppt.addPicture(new File("image.jpg"), Picture.JPEG);
Picture pict = new Picture(idx1);
Picture pict2 = new Picture(idx2);
Is there another way to solve this problem?
MG
Yegor Kozlov wrote:
>
> Your code works for me. I tested in PowerPoint 2003 and OpenOffice 2.2
> and the images are in place.
>
> Which version of PowerPoint you are using? Anything special with the
> image file?
>
> Yegor
>
>
--
View this message in context: http://www.nabble.com/HSLF-multiple-image-insertion-tp17536146p17560637.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: HSLF multiple image insertion
Posted by Yegor Kozlov <ye...@dinom.ru>.
Your code works for me. I tested in PowerPoint 2003 and OpenOffice 2.2
and the images are in place.
Which version of PowerPoint you are using? Anything special with the
image file?
Yegor
> Hello
> I want to insert the same image on several slides, but it works only on the
> first slide.
> For the others I've got a red cross.
> Here a sample code :
> SlideShow ppt = new SlideShow();
>
> Slide s = ppt.createSlide();
> Slide s2 = ppt.createSlide();
> Slide s3 = ppt.createSlide();
>
> int idx = ppt.addPicture(new File("image.jpg"), Picture.JPEG);
> Picture pict = new Picture(idx);
> Picture pict2 = new Picture(idx);
> Picture pict3 = new Picture(idx);
>
> pict.setAnchor(new Rectangle(10,10,100,100));
> s.addShape(pict);
>
>
> pict2.setAnchor(new Rectangle(10,10,100,100));
> s2.addShape(pict2);
>
>
> pict3.setAnchor(new Rectangle(10,10,100,100));
> s3.addShape(pict3);
> FileOutputStream out = new FileOutputStream("report.ppt");
> ppt.write(out);
> out.close();
> Thanks
> MG
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org