Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Java Poi Draw Line in PowerPoint Presentation Using Java

Related Tutorials


 
 

Share on Google+Share on Google+

Draw Line in PowerPoint Presentation Using Java

Advertisement
In this example we are going to create line in PowerPoint presentation using java.

Draw Line in PowerPoint Presentation Using Java

     


In this example we are going to create line in PowerPoint presentation using java.

In this example we are going to make an slide and we are inserting a line in it. To insert a line we are making a line, set line style and color.  To create an object of Line we are using Line() constructor. At last we are adding the line in slide. The setLineStyle(style) method is used to set the style of line. The setLineColor(Color color) method is used to add the color of the line.
  
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.Line;
class drawLine{
  public static void main(String a[])
  {
  try
  SlideShow slideShow = new SlideShow();
  Slide slide = slideShow.createSlide();
 Line line = new Line();
 line.setAnchor(new java.awt.Rectangle
(
5050600,500));
 line.setLineColor(new Color(01280));
 line.setLineStyle(Line.LINE_DOUBLE);
 slide.addShape(line);
 FileOutputStream out = new FileOutputStream
(
"drawLine.ppt");
  slideShow.write(out);
  out.close();
  }catch(Exception e){}
  }}

The output of the program is given below:

Download this example.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 14, 2008

Related Tutorials

Discuss: Draw Line in PowerPoint Presentation Using Java   View All Comments

Post your Comment


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