Hi Yegor,

I tried to run the follwing code, But I am getting some null pointer
exception as below
_records in TextRun.java is null. Why is this _records is used for? What can
be done to resolve this ?

Exception:
Exception in thread "main" java.lang.NullPointerException
        at org.apache.poi.hslf.model.TextRun.getTextRuler(TextRun.java:671)
        at org.apache.poi.hslf.model.TextPainter.paint(TextPainter.java:128)
        at org.apache.poi.hslf.model.TextShape.draw(TextShape.java:531)
        at
org.apache.poi.hslf.examples.TextPainter_small.main(TextPainter_small.java:57)


Program
        SlideShow ppt = new SlideShow();
        ppt.setPageSize(new Dimension(720, 540));
       
        Slide slide = ppt.createSlide();
        
        ShapeGroup group = new ShapeGroup();
        //define position of the drawing in the slide
        Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
        group.setAnchor(bounds);
        slide.addShape(group);
        TextBox box1 = new TextBox();
        group.setCoordinates(new java.awt.Rectangle(0, 0, 100, 100));
        group.addShape(box1);
        
        Graphics2D graphics = new PPGraphics2D(group);
        
                
            TextRun tr1 = box1.createTextRun();         
            tr1.getRichTextRuns()[0].setFontSize(12);
            tr1.getRichTextRuns()[0].setFontName("Arial");
            box1.setHorizontalAlignment(TextBox.AlignLeft);
            tr1.setText(
                    "Yegor Kozlov\r" +
                    "yegor - apache - org\r" +
                    "yegor - apache - org\r" +              
                    "yegor - apache - org");        
            
            /*TextPainter painter = new TextPainter(box1);
        painter.paint(graphics);*/
                    
            box1.draw(graphics);
            slide.addShape(box1);
-- 
View this message in context: 
http://www.nabble.com/Generating-ppt-through-java-tp18399673p18527013.html
Sent from the POI - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to