ty for your awnser.
Issnt it possible to copy all (mostrecent) records and rebuild the presentation out of it? or are the style properties saved in some other place? Im asking this, cuz i searched a bit in the source-tree and found some interesting classes that are dumping the data on the record-layer. For example the PPTXMLDump.java from you, Yegor, does it generate a xml file with all necesary data to rebuild the presentation?

regards,
felix

Yegor Kozlov schrieb:
Generally speaking, your rebuilt ppt will always be lossy. You have to rebuilt the master sheet too but for now masters are read-only - HSLF can read from master sheets but can't modify them.

There are three important pieces of data to preserve:

 (a) Anchor - defines position of a shape in the slide:
    Rectangle2D anchor = shape.getAnchor2D();

 (b) Text properties, the ones returned by RichTextRun getters.

 (c) basic shape properties, aka "Escher" properties.
The code below demonstrates how to copy Escher properties from one shape to another :


        Map<Integer, Integer> shapeProps = new HashMap();
        org.apache.poi.hslf.model.Shape srcShape = ....; // source shape
EscherOptRecord opt = (EscherOptRecord)srcShape.getEscherChild(srcShape.getSpContainer(), EscherOptRecord.RECORD_ID); for (Iterator it = opt.getEscherProperties().iterator(); it.hasNext(); ) {
            Object p = it.next();
            if(p instanceof EscherSimpleProperty){
                EscherSimpleProperty sp = (EscherSimpleProperty)p;
                int propId = sp.getId();
                int propValue = sp.getPropertyValue();
                shapeProps.put(propId, propValue);
            } else {
                //for simplicity skip complex and array properties
            }
        }

        //rebuilding presentation
        org.apache.poi.hslf.model.Shape tgtShape = ...; //target shape
for (Iterator<Integer> it = shapeProps.keySet().iterator(); it.hasNext(); ) {
            int propId = it.next();
            int propValue = shapeProps.get(propId);
            tgtShape.setEscherProperty((short)propId, propValue);
        }


Regards,
Yegor

Hi all,
i wrote a programm that iterates over all slides of a presentation and saves all the data of its elements (raw text of TextBoxes/AutoShapes, binary data of Pictures, etc) in some other place.
now i want to "rebuild" the presentation with those elements.
So my question is what fields/objects must i save that the rebuilded presentation looks like the original one? For now, im just talking about TextBoxes and AutoShapes, but i dont mind any answer that helps with other Shape-objects too :) When i save all the fields from my RichTextRun and Shape-objects i have getter/setter-Methods for (eg. fontname/size, bold, italic... margin, alignment...) it doesnt look the same. if i write my original created SlideShow-object out to the filesystem, it looks like the original presenation... So i think i just miss to save some fields... Maybe theres a way to marshal/unmarshal the objects needed to format the presentation, so i dont have to handle with alot of fields... Since i dont know alot about mastersheets and i read that POI dont know much either, i dont know what can be handled through it...

greetings,
Felix

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




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




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

Reply via email to