poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <ye...@dinom.ru>
Subject Re[2]: Is PPT Merging possible with HSLF
Date Fri, 07 Apr 2006 06:31:25 GMT
Hi  Poornima,

OK, since you want it right now here it is:

        //source ppt
        String  srcppt; //path to the source presentation
        SlideShow src = new SlideShow(new HSLFSlideShow(srcppt));

        //target ppt to copy slides to. 
        // In this example it is a new ppt but you can add slides to existing one.
        SlideShow tgt = new SlideShow();

        Slide[] sl = src.getSlides(); //get slides
        for (int i = 0; i < sl.length; i++) {
            
            Slide slide = tgt.createSlide(); //create a slide to copy shapes to

            //copy shapes from the source ppt
            Shape[] sh = sl[i].getShapes();
            for (int j = 0; j < sh.length; j++) {
                slide.addShape(sh[j]);
            }
        }

        OutputStream out = new FileOutputStream("merged.ppt");
        tgt.write(out);
        out.close();


This code is new, it was commited a month ago and most likely there
are bugs. Text formatting may not be preserved fully. Complex shapes
like tables may not work.
The example above is just a demonstration of capabilities  (a
technology preview). There are lots of undone stuff.
 Let me know if you have problems with a particular type of shape.

 
Regards, Yegor Kozlov

PA> Thanks Yegor,

PA> Could i get the example you were talking ablout?

PA> Thanks a lot,
PA> Poornima


PA> On 4/6/06, Yegor Kozlov <yegor@dinom.ru> wrote:
>>
>> Hi
>>
>> No, you can't do it for now. HSLF is young and evolving project and
>> the described functionality is not implemented yet.
>>
>> HSLF already knows how to get list of slides for a PPT, read shapes
>> contained within a
>> particular slide and read/edit/add a limited set of shape's properties.
>> Actually it is what I've been implementing last months.
>> Copying of simple shapes (TextBox, Line, etc) to another PPT seems not
>> difficult to me. I can't give you an example right now but if
>> everything is OK a demo can be expected in a month or so.
>>
>> It won't work if your source PPTs contain complex shapes (Tables or custom
>> curves
>> which are described by  an arbitrary set of points). These guys are in
>> my TODO list but my hands are always full and I can't say how soon I
>> will proceed to them.
>>
>> Regards, Yegor Kozlov
>>
>> PA> Hi,
>>
>> PA> I need to merge two or more ppts to a new ppt. I also need to add my
>> own
>> PA> slides at the top and bottom of the merged PPT. All the formatting,
>> color,
>> PA> layout of both the PPT should be retained.
>>
>> PA> Please let me now if this is possible with HSLF. Any pointers would be
>> PA> greatly appreciated.
>>
>> PA> Thanks,
>> PA> Poornima
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>> Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
>> The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message