In this example we are going to create a slide then change background picture of the slide.
Change Background Picture of Slide Using Java
In this example we are going to create a slide then change background picture of the slide.
In this example we are creating a slide. In this slide we are inserting a picture to set this picture as background. To set picture as background of slide we are using setPictureData(nameofpicture ) method. We are setting the pattern type of the picture. To set the pattern we are using setFillType(filltype) method.
addPicture(byte[] pictureData,int format):
This method is used to add a picture to the workbook. The return type of this method is int. The two parameters are passed into this method. The first one is pictureData and second one is format .The pictureData is byte form of the picture. In this example we are using Picture.PNG as format.
setPictureData(byte[] pictureData):
This method is used to set the picture. Here picture data is name of picture in byte format.
The code of the program is given below:
import org.apache.poi.hslf.HSLFSlideShow;
|
The output of the program is given below: