You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by dhshin <dh...@2e.co.kr> on 2011/07/19 17:51:25 UTC

how to makes a end style of line with arrows using hslf api?

Dear Ladies and Gentleman!

I'm developing a powerpoint based diagram generator.

But I have three problem!

 

First)

Could you tell me, how to makes a end style of line with arrows using hslf
api?

Second)

Please tell me, how to connect a Line object and a Shape object using hslf
api?

Third)

Could you show me, how to make a shadow and 3D effect at Shape object using
hslf api?

 

Could you send me sample code?

 

Have a nice day! 

Thank you!

 

Code is as follows:

 

 

package kr.co.twoe.bp.aris;

 

import java.io.FileOutputStream;

import java.io.IOException;

 

import org.apache.poi.hslf.model.AutoShape;

import org.apache.poi.hslf.model.Line;

import org.apache.poi.hslf.model.ShapeTypes;

import org.apache.poi.hslf.model.Slide;

import org.apache.poi.hslf.usermodel.SlideShow;

 

public class POITestCase {

 

       public void questionOne() throws IOException {

             SlideShow ppt = new SlideShow();

             ppt.setPageSize(new java.awt.Dimension(1024, 786));

             Slide slide = ppt.createSlide();

 

             Line line1 = new Line();

             line1.setAnchor(new java.awt.Rectangle(50, 50, 100, 50));

             line1.setLineStyle(Line.LINE_SIMPLE);

             slide.addShape(line1);

             // how to makes a end style of line with arrows using hslf api?

             

             AutoShape line2 = new AutoShape(ShapeTypes.BentConnector3);

             line2.setAnchor(new java.awt.Rectangle(50, 300, 100, 50));

             slide.addShape(line2);

             

             // how to makes a end style of line with arrows using hslf api?

 

             FileOutputStream out = new
FileOutputStream("C:\\Work\\slideshow1.ppt");

             ppt.write(out);

             out.close();

       }

 

       public void questionTwo() throws IOException {

             SlideShow ppt = new SlideShow();

             ppt.setPageSize(new java.awt.Dimension(1024, 786));

             Slide slide = ppt.createSlide();

 

             AutoShape shape1 = new AutoShape(ShapeTypes.RoundRectangle);

             shape1.setAnchor(new java.awt.Rectangle(50, 50, 100, 50));

             shape1.setText("Helo,World1");

             shape1.setShapeId(1);

             slide.addShape(shape1);

 

             AutoShape shape2 = new AutoShape(ShapeTypes.Hexagon);

             shape2.setAnchor(new java.awt.Rectangle(50, 150, 100, 50));

             shape2.setText("Helo,World2");

             shape2.setShapeId(2);

             slide.addShape(shape2);

 

             AutoShape shape3 = new AutoShape(ShapeTypes.BentConnector3);

             shape3.setAnchor(new java.awt.Rectangle(100, 100, 0, 50));

             shape3.setShapeId(3);

             slide.addShape(shape3);

 

             // how to connect a Line object and a Shape object using hslf
api?

 

             FileOutputStream out = new
FileOutputStream("C:\\Work\\slideshow2.ppt");

             ppt.write(out);

             out.close();

       }

 

       public void questionThree() throws IOException {

             SlideShow ppt = new SlideShow();

             ppt.setPageSize(new java.awt.Dimension(1024, 786));

             Slide slide = ppt.createSlide();

 

             AutoShape shape1 = new AutoShape(ShapeTypes.RoundRectangle);

             shape1.setAnchor(new java.awt.Rectangle(50, 50, 100, 50));

             shape1.setText("Helo,World1");

             shape1.setShapeId(1);

             slide.addShape(shape1);

 

             // how to makes a shadow and 3D dffect at Shape object using
hslf api?

 

             FileOutputStream out = new
FileOutputStream("C:\\Work\\slideshow3.ppt");

             ppt.write(out);

             out.close();

       }

 

       /**

       * @param args

       */

       public static void main(String[] args) {

             POITestCase tester = new POITestCase();

             try {

                    tester.questionOne();

                    tester.questionTwo();

                    tester.questionThree();

 

             } catch (IOException e) {

                    e.printStackTrace();

             }

 

       }

 

}