Examples of ExOleObjAtom


Examples of org.apache.poi.hslf.record.ExOleObjAtom

    ExControl ctrl = new ExControl();
    ctrl.setProgId(progId);
    ctrl.setMenuName(name);
    ctrl.setClipboardName(name);
   
    ExOleObjAtom oleObj = ctrl.getExOleObjAtom();
    oleObj.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE);
    oleObj.setType(ExOleObjAtom.TYPE_CONTROL);
    oleObj.setSubType(ExOleObjAtom.SUBTYPE_DEFAULT);
   
    int objectId = addToObjListAtom(ctrl);
    oleObj.setObjID(objectId);
    return objectId;
  }
View Full Code Here

Examples of org.apache.poi.hslf.record.ExOleObjAtom

        exEmbed.removeChild(children[4]);

        ExEmbedAtom eeEmbed = exEmbed.getExEmbedAtom();
        eeEmbed.setCantLockServerB(true);

        ExOleObjAtom eeAtom = exEmbed.getExOleObjAtom();
        eeAtom.setDrawAspect(ExOleObjAtom.DRAW_ASPECT_VISIBLE);
        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;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.