Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

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;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hslf.usermodel.SlideShow;
import org.apache.poi.hslf.model.*;
import java.io.*;
import java.awt.Color;
import org.apache.poi.hslf.model.TextBox;
class slideBackgroundShap
{
  public static void main(String a[])
  {
  try
  {                
        SlideShow slideShow = new SlideShow();
        Slide slide = slideShow.createSlide();
        slide.setFollowMasterBackground(false);
        Fill fill = slide.getBackground().getFill();
        int id = slideShow.addPicture(new File
(
"1.png"), Picture.PNG);
        fill.setFillType(Fill.FILL_PATTERN);
        fill.setPictureData(id);
        FileOutputStream out = new FileOutputStream
(
"slideBackground.ppt");
        slideShow.write(out);
        out.close();             
  }catch(Exception e){}
  }}

The output of the program is given below:

Download this example.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Latest Searches:
checkbox in jsp
scrolling text
download
count row in resultset
swings ioc
Treemapusinggwttree
Convert float to biner
servlet to jsp
how to upload image ur
text box character val
Html tutorial
Flash Animation Tweene
mysql-connector-java-3
httpRequest
springtutorial
prime numbers between
phoneformate
file oracle jsp
MurachÑ??Ð?аÐ???Ñ??Ð?
java date compare exam
digital numbers recogn
javascript to save dat
Cape Clear Orchestrato
coding of radio button
LAMJ
Combattons la programm
appendingtoafilejava
NetBeans IDE
Building a Simple EJB
rowfilter
scrolling text banner
sample code
System.exit(0)
Photoshop Textures and
readingfile(java)
compare two arraylist
string variable
Photoshop Drawing Draw
Veloscity
how to execute update
ASP Ad Management CJ s
javascript+save data
break��??�
distributed cache upda
<s:push> in struts2
json lib/componen...]=
struts 2 checkbox
retreiving elements in
formfile encoding
struts jdbc
JPOS
web application tomcat
jsf hibernate tutorial
scrolling text from r
given list is sorted
how to read tab separa
java file browser dial
Two-dimensional
how to use java collec
converting long to str
jsp struts 2 tags
multiple table pdf i
pojo
rtsp
ejb2.0
Disadvantagesofanexcep
using finally exceptio
threads methods
Eclipse 3.4 session be
to set combox
javascript+save date
result tag in struts 2
point to the start of
Eclipse 3.4 session be
requestDispatcherexamp
update
List in J2ME
jspregistrationform
jpanel
Java example program t
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.