Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Set Textbox in PowerPoint Slide Using Java

In this example we are going create textbox to set text in PowerPoint using java.

Ads

Set Textbox in PowerPoint Slide Using Java

     


In this example we are going create textbox to set text in PowerPoint using java.

In this example we are creating an object of  ShlideShow, after that we are using createSlide() method to create an object of  Slide. To make a textbox we need first create an object of  TexBox . Then by use of setText(String str) we can pass the string value in textbox. At last set the position and textbox size by use of setAnchor() method. Finally add it into slide by use of addShape(TexBox texbox). 
  
 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.SlideShow;
import java.io.*;
import java.awt.*;
import org.apache.poi.hslf.model.TextBox;
class createTextBox
{
  public static void main(String a[])
  {
  try
  { SlideShow slideShow = new SlideShow();
 Slide slide = slideShow.createSlide();

  TextBox txtBox = new TextBox();
  txtBox.setText("Hello, World!");
  txtBox.setAnchor(new java.awt.Rectangle
(
30010030050));
 slide.addShape(txtBox);
  FileOutputStream out = new FileOutputStream
(
"textBox.ppt");
  slideShow.write(out);
  out.close();
  }catch(Exception e){}
  }}

The output of the program is given below:

Download this example.

Advertisements

Ads
Share on Google+Share on Google+

Set Textbox in PowerPoint Slide Using Java

Posted on: March 14, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: Set Textbox in PowerPoint Slide Using Java  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads