Hi,
I am new to POI. I am trying out the sample examples that were given in POI
site.
I am getting the following error while opening the ppt file generated,just
after executing the following program. Can anyone tell me what might be the
problem was?
Thanks in advance.
Error:PowerPoint cant open the type of file represented by C:\Test\Presen.ppt
And the java file is :
public class PPTExample {
public static void main(String ar[]){
try{
SlideShow ppt = new SlideShow();
HSSFWorkbook wb = new HSSFWorkbook();
Slide slide = ppt.createSlide();
//Line shape
Line line = new Line();
line.setAnchor(new java.awt.Rectangle(50, 50, 100, 20));
line.setLineColor(new Color(0, 128, 0));
line.setLineStyle(Line.LineDashDotSys);
slide.addShape(line);
//TextBox
TextBox txt = new TextBox();
txt.setText("Hello, World!");
txt.setAnchor(new java.awt.Rectangle(100, 100, 200, 50));
txt.setFontSize(32);
txt.setFontName("Arial");
txt.setBold(true);
slide.addShape(txt);
//Autoshape
//32-point star
AutoShape sh1 = new AutoShape(ShapeTypes.Star32);
sh1.setAnchor(new java.awt.Rectangle(50, 50, 100, 200));
sh1.setFillColor(Color.red);
slide.addShape(sh1);
//Trapezoid
AutoShape sh2 = new AutoShape(ShapeTypes.Trapezoid);
sh2.setAnchor(new java.awt.Rectangle(150, 150, 100, 200));
sh2.setFillColor(Color.blue);
slide.addShape(sh2);
FileOutputStream out = new FileOutputStream("C:/Test/Presen.ppt");
wb.write(out);
out.close();
}catch(Exception e){
System.out.println("Exception = "+e);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/