You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Thorsten Bux <Th...@gmx.de> on 2008/08/22 14:29:48 UTC

How to generate OLEShapes and put them into PPT-Files

Hi,

I would like to know how to generate OLEShapes and put them in a PPT-Slide.

Thanks
Thorsten
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: getShapes() and Table

Posted by Constantin Volozhin <cv...@pragmaticsoft.com>.
Thanks a lot, it works now. But related bug there (trunk code):

the code snippet:

        SlideShow ppt = new SlideShow();
        Slide slide = ppt.createSlide();

        slide.addShape(new Table(1, 5));
        
        Shape[] shapes = slide.getShapes();
        

brings following error on getShapes():

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
	at org.apache.poi.hslf.model.Table.initTable(Table.java:180)
	at org.apache.poi.hslf.model.Table.setSheet(Table.java:193)
	at org.apache.poi.hslf.model.Sheet.getShapes(Sheet.java:229)
	at JustPOI.main(JustPOI.java:116)


Brings error only if table has only 1 row. Could you fix please also?
Thanks for you work!




> Fixed in r690262.
> 
> Yegor
> 
> > getShapes() code brings exception. Looks like bug. (trunk code used)
> > 
> > 
> > Exception in thread "main" java.lang.ClassCastException:
> > org.apache.poi.ddf.EscherOptRecord cannot be cast to
> > org.apache.poi.ddf.UnknownEscherRecord
> > 	at
> > org.apache.poi.hslf.model.ShapeFactory.createShapeGroup(ShapeFactory.java:48)
> > 	at
> > org.apache.poi.hslf.model.ShapeFactory.createShape(ShapeFactory.java:39)
> > 	at org.apache.poi.hslf.model.Sheet.getShapes(Sheet.java:228)
> > 	at JustPOI.main(JustPOI.java:29)
> > 
> > 
> > Code snippet to test:
> > 
> >         SlideShow ppt = new SlideShow();
> >         Slide slide = null;
> >         
> >         try {
> >             slide = ppt.createSlide();
> >         } catch (IOException e1) {
> >             e1.printStackTrace();
> >         }
> > 
> >         slide.addShape(new Table(2, 5));
> >         
> >         Shape[] shapes = slide.getShapes();
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> > For additional commands, e-mail: user-help@poi.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: getShapes() and Table

Posted by Yegor Kozlov <ye...@dinom.ru>.
Fixed in r690262.

Yegor

> getShapes() code brings exception. Looks like bug. (trunk code used)
> 
> 
> Exception in thread "main" java.lang.ClassCastException:
> org.apache.poi.ddf.EscherOptRecord cannot be cast to
> org.apache.poi.ddf.UnknownEscherRecord
> 	at
> org.apache.poi.hslf.model.ShapeFactory.createShapeGroup(ShapeFactory.java:48)
> 	at
> org.apache.poi.hslf.model.ShapeFactory.createShape(ShapeFactory.java:39)
> 	at org.apache.poi.hslf.model.Sheet.getShapes(Sheet.java:228)
> 	at JustPOI.main(JustPOI.java:29)
> 
> 
> Code snippet to test:
> 
>         SlideShow ppt = new SlideShow();
>         Slide slide = null;
>         
>         try {
>             slide = ppt.createSlide();
>         } catch (IOException e1) {
>             e1.printStackTrace();
>         }
> 
>         slide.addShape(new Table(2, 5));
>         
>         Shape[] shapes = slide.getShapes();
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


getShapes() and Table

Posted by Constantin Volozhin <cv...@pragmaticsoft.com>.
getShapes() code brings exception. Looks like bug. (trunk code used)


Exception in thread "main" java.lang.ClassCastException:
org.apache.poi.ddf.EscherOptRecord cannot be cast to
org.apache.poi.ddf.UnknownEscherRecord
	at
org.apache.poi.hslf.model.ShapeFactory.createShapeGroup(ShapeFactory.java:48)
	at
org.apache.poi.hslf.model.ShapeFactory.createShape(ShapeFactory.java:39)
	at org.apache.poi.hslf.model.Sheet.getShapes(Sheet.java:228)
	at JustPOI.main(JustPOI.java:29)


Code snippet to test:

        SlideShow ppt = new SlideShow();
        Slide slide = null;
        
        try {
            slide = ppt.createSlide();
        } catch (IOException e1) {
            e1.printStackTrace();
        }

        slide.addShape(new Table(2, 5));
        
        Shape[] shapes = slide.getShapes();




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org