I want to serialize the most recent records to some binary file.
Could you give me some information on how i can rebuild the ppt of the
binary data records stream.
I thought that i only save the most recent records due to disk space and
so i dont have to handle with the PersistIncBlock-Stuff. Is this idea
right and do i have all necesary data to rebuild exactly the same ppt in
the most recent recs?
regards,
felix
Yegor Kozlov schrieb:
For example the PPTXMLDump.java from you, Yegor, does it generate a
xml file with all necesary data to rebuild the presentation?
Yes, it generates all necessary data to rebuild the presentation.
Suppose you serialize root records and want to assemble a ppt from
them. A typical structure of records is as follows:
- Document
- MainMaster
- Slide1
- Slide2
...
- Slide N
- PersistIncrementalBlock
- UserEditAtom
The tricky part is PersistIncrementalBlock. For each root record it
maps the record offset and persistId. In its turn, persistId is
referenced in Document.SlideListWithText.SlidePersistAtom. If you
assemble a ppt from slides from different slide shows you need to make
sure Document.SlideListWithText and PersistIncrementalBlock match.
Yegor
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]
---------------------------------------------------------------------
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]