poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <ye...@dinom.ru>
Subject Re: Cloning of slides
Date Fri, 28 Dec 2007 09:22:24 GMT
Cloning slides is  not yet supported. You have to iterate over the
shapes and re-create them in the target slide.

To recognize bullets use RichTextRun.isBullet(). To set bullets use
RichTextRun.setBullet(boolean flag)

Support for ppt tables is in progress. I'm going to include it in
3.0.2 FINAL. For now there is no way to clone ppt tables.

Regards,
Yegor
>  

> Hello 

>  

>             I am Ritwik currently working on presentation module for a
> product which needs creating a new presentation from two different
> presentations.

> What I am currently doing is:

>  

> 1.      Creating two slide shows for both the PPTs. (here we will add
> desired slide of 2nd PPT at the end of 1st)
> 2.      for each slide in the 2nd PPT

> *         Extract text out of textboxes, format it as its was in the
> previous slide

> *         Extract auto shapes

> *         Extract lines

> *         Extract pictures

>  

> 3.      Add the extracts by creating new slide at end of PPT1.

>  

>  

>  

> SlideShow ppt1 = new SlideShow(input stream of 1st ppt);

> SlideShow ppt2 = new SlideShow(nput stream of 2nd ppt);

>  

> Slide slide[] = ppt2.getSlides();

>  

> for(int i=0; i< slide.length; i++)

>         {

>             Slide newSlide = ppt1.createSlide();

>             newSlide.setFollowMasterBackground(true);

>             TextRun textRun[] = slide[i].getTextRuns();

>             Shape sh[] = slide[i].getShapes();

>             for (int j = 0; j < sh.length; j++)

>             {

>                 //shapes's anchor which defines the position of this shape
> in the slide

>                 java.awt.Rectangle anchor = sh[j].getAnchor();

>  

>                 if (sh[j] instanceof Line)

>                 {

>                     Line line = (Line)sh[j];

>                     Line newLine = new Line();

>                     newLine.setAnchor(anchor);

>                     newLine.setLineColor(line.getLineColor());

>                     newLine.setLineStyle(line.getLineStyle());

>                     newSlide.addShape(newLine);

>                 }

>                 else if (sh[j] instanceof AutoShape)

>                 {

>                     AutoShape shape = (AutoShape)sh[j];

>                     shape.setAnchor(anchor);

>                     newSlide.addShape(shape);

>                 }

>                 else if (sh[j] instanceof TextBox)

>                 {

>                     TextBox shape = (TextBox)sh[j];

>  

>                     TextBox txt = new TextBox();

>                     txt.setText(textRun[j].getText());

>                     txt.setAnchor(anchor);

>                     RichTextRun rt =
> shape.getTextRun().getRichTextRuns()[0];

>                     RichTextRun newRt =
> txt.getTextRun().getRichTextRuns()[0];

>                     newRt.setFontSize(rt.getFontSize());

>                     newRt.setFontName(rt.getFontName());

>                     newRt.setBold(rt.isBold());

>                     newRt.setItalic(rt.isItalic());

>                     newRt.setUnderlined(rt.isUnderlined());

>                     newRt.setFontColor(rt.getFontColor());

>                     newRt.setAlignment(rt.getAlignment());

>                     newSlide.addShape(txt);

>                 }

>                 else if (sh[j] instanceof Picture)

>                  {

>  

>                     Picture pict = (Picture)sh[j];

>                     PictureData pictData = pict.getPictureData();

>                     byte[] data = pictData.getData();

>                     int type = pictData.getType();

>                     int id =ppt1.addPicture(data,type);

>                     Picture pict1 = new Picture(id);

>                     //set image position in the slide

>                     pict1.setAnchor(anchor);

>                     newSlide.addShape(pict1);

>  

>                 }

>             }

>  

>         }

>  

>  

>  

>  

> In short we need to clone the slides of 2nd PPT, so is there any easier and
> efficient method to clone required slides of a PPT ???

>  

> Because currently I am facing following issues:

> *       Copy the TABLE from one PPT to another
> *       To recognize BULLET LIST and NUMBERED LIST and reproduce it as such

>  

>  

>  

> Thanking you,

> Ritwik Kumar



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


Mime
View raw message