eeAtom.setType(ExOleObjAtom.TYPE_EMBEDDED);
// eeAtom.setSubType(ExOleObjAtom.SUBTYPE_EXCEL);
// should be ignored?!?, see MS-PPT ExOleObjAtom, but Libre Office sets it ...
eeAtom.setOptions(1226240);
ExOleObjStg exOleObjStg = new ExOleObjStg();
try {
final String OLESTREAM_NAME = "\u0001Ole";
if (!root.hasEntry(OLESTREAM_NAME)) {
// the following data was taken from an example libre office document
// beside this "\u0001Ole" record there were several other records, e.g. CompObj,
// OlePresXXX, but it seems, that they aren't neccessary
byte oleBytes[] = { 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
poiData.createDocument(new ByteArrayInputStream(oleBytes), OLESTREAM_NAME);
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
poiData.writeFilesystem(bos);
exOleObjStg.setData(bos.toByteArray());
} catch (IOException e) {
throw new HSLFException(e);
}
int psrId = addPersistentObject(exOleObjStg);
exOleObjStg.setPersistId(psrId);
eeAtom.setObjStgDataRef(psrId);
int objectId = addToObjListAtom(exEmbed);
eeAtom.setObjID(objectId);
return objectId;