Home Java Poi Draw Line in PowerPoint Presentation Using Java



Draw Line in PowerPoint Presentation Using Java
Posted on: March 14, 2008 at 12:00 AM
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.

Related Tags for Draw Line in PowerPoint Presentation Using Java:
javacideconstructorobjectinsertstyleiostructmakemethodsedcolorconstpowerpointusingintlinethisidsetetlcreatepoiexampleaddtopointexamlinespowerpresentationerpasteslideitlastliuseinaddinaddingasmnttrddjadesmeobjtorxawerxampsctorcolatkismplpregoeaandarconsstrrtslivasetlssthavstatictojepleplprndonolo


More Tutorials from this section

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

Post your Comment


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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.