Hi,
I Fixed the second problem(How to get background pic)
BUT i still not able to ADD a background to a new PPT file
get existing background
/*************************/
try{
SlideShow syntheseDetaille=new SlideShow(new
HSLFSlideShow("c:\\Synthese_temp.ppt"));
SlideMaster master2=syntheseDetaille.getSlidesMasters()[0];
//Fill fill2 =master2.getBackground().getFill();
for(int i=0;i<syntheseDetaille.getPictureData().length;i++)
{
int type =syntheseDetaille.getPictureData()[i].getType();
String ext;
switch (type){
case Picture.JPEG: ext=".jpg"; break;
case Picture.PNG: ext=".png"; break;
case Picture.WMF: ext=".wmf"; break;
case Picture.EMF: ext=".emf"; break;
case Picture.PICT: ext=".pict"; break;
default: continue;
}
OutputStream st=new FileOutputStream(new
File("c:\\pic"+i+"."+ext));
st.write(syntheseDetaille.getPictureData()[i].getData());
//System.out.println("fill type fill ID"+fill2.getFillType());
st.close();
}
}catch(Exception e){
e.printStackTrace();
}
isfelly wrote:
>
> Hi all
> I'm working with poi3.5 beta5
> i have a problem when i try to read Or add background
> Code for adding
> SlideShow slideShow = new SlideShow();
> SlideMaster master = slideShow.getSlidesMasters()[0];
> Fill fill = master.getBackground().getFill();
> int id = slideShow.addPicture(new File("c:\\bag.png"),
> Picture.PNG);
> fill.setFillType(Fill.FILL_PICTURE);
> fill.setPictureData(id);
> FileOutputStream out = new
> FileOutputStream("c:\\MasterBackground.ppt");
> slideShow.write(out);
> out.close();
>
> Code for reading
>
> SlideShow syntheseDetaille=new SlideShow(new
> HSLFSlideShow("c:\\Synthese_temp.ppt"));
> SlideMaster master=syntheseDetaille.getSlidesMasters()[0];
> Fill fill =master.getBackground().getFill();
>
> OutputStream st=new FileOutputStream(new File("c:\\pic.jpg"));
> st.write(fill.getPictureData().getData());
> st.close();
> //NULL POINTER EXCEPTION!!
>
Thank You for your helps
isfelly
--
View this message in context:
http://www.nabble.com/Background-PPT-error-%28urgent%21%29-tp23808770p23808907.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]