/** * Creates section 2 if it is not already present. */ private void ensureSection2() { if (getSectionCount() < 2) { Section s2 = new Section(); s2.setFormatID(USER_DEFINED_PROPERTIES); addSection(s2); } }
/** * Removes the custom properties. */ public void removeCustomProperties() { if (getSectionCount() < 2) { throw new HPSFRuntimeException("Illegal internal format of Document SummaryInformation stream: second section is missing."); } List<Section> l = new LinkedList<>(getSections()); clearSections(); int idx = 0; for (Section s : l) { if (idx++ != 1) { addSection(s); } } }
/** * Gets the custom properties. * * @return The custom properties. */ public CustomProperties getCustomProperties() { CustomProperties cps = null; if (getSectionCount() >= 2) { cps = new CustomProperties(); final Section section = getSections().get(1); final Map<Long,String> dictionary = section.getDictionary(); final Property[] properties = section.getProperties(); int propertyCount = 0; for (Property p : properties) { final long id = p.getID(); if (id == PropertyIDMap.PID_CODEPAGE) { cps.setCodepage((Integer)p.getValue()); } else if (id > PropertyIDMap.PID_CODEPAGE) { propertyCount++; final CustomProperty cp = new CustomProperty(p, dictionary.get(id)); cps.put(cp.getName(), cp); } } if (cps.size() != propertyCount) { cps.setPure(false); } } return cps; }
/** * <p>Removes the custom properties.</p> */ public void removeCustomProperties() { if (getSectionCount() >= 2) getSections().remove(1); else throw new HPSFRuntimeException("Illegal internal format of Document SummaryInformation stream: second section is missing."); }
/** * <p>Removes the custom properties.</p> */ public void removeCustomProperties() { if (getSectionCount() >= 2) getSections().remove(1); else throw new HPSFRuntimeException("Illegal internal format of Document SummaryInformation stream: second section is missing."); }
/** * Creates section 2 if it is not already present. */ private void ensureSection2() { if (getSectionCount() < 2) { Section s2 = new Section(); s2.setFormatID(USER_DEFINED_PROPERTIES); addSection(s2); } }
/** * <p>Creates section 2 if it is not already present.</p> * */ private void ensureSection2() { if (getSectionCount() < 2) { MutableSection s2 = new MutableSection(); s2.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[1]); addSection(s2); } }
/** * <p>Creates section 2 if it is not already present.</p> * */ private void ensureSection2() { if (getSectionCount() < 2) { MutableSection s2 = new MutableSection(); s2.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[1]); addSection(s2); } }
/** * Removes the custom properties. */ public void removeCustomProperties() { if (getSectionCount() < 2) { throw new HPSFRuntimeException("Illegal internal format of Document SummaryInformation stream: second section is missing."); } List<Section> l = new LinkedList<>(getSections()); clearSections(); int idx = 0; for (Section s : l) { if (idx++ != 1) { addSection(s); } } }
System.out.println("# mmclips: "+doc.getDocumentSummaryInformation().getMMClipCount()); System.out.println("# notes: "+doc.getDocumentSummaryInformation().getNoteCount()); System.out.println("# sections: "+doc.getDocumentSummaryInformation().getSectionCount()); System.out.println("# slides: "+doc.getDocumentSummaryInformation().getSlideCount()); System.out.println("format: "+doc.getDocumentSummaryInformation().getFormat());
System.out.println("# mmclips: "+doc.getDocumentSummaryInformation().getMMClipCount()); System.out.println("# notes: "+doc.getDocumentSummaryInformation().getNoteCount()); System.out.println("# sections: "+doc.getDocumentSummaryInformation().getSectionCount()); System.out.println("# slides: "+doc.getDocumentSummaryInformation().getSlideCount()); System.out.println("format: "+doc.getDocumentSummaryInformation().getFormat());
/** * Gets the custom properties. * * @return The custom properties. */ public CustomProperties getCustomProperties() { CustomProperties cps = null; if (getSectionCount() >= 2) { cps = new CustomProperties(); final Section section = getSections().get(1); final Map<Long,String> dictionary = section.getDictionary(); final Property[] properties = section.getProperties(); int propertyCount = 0; for (Property p : properties) { final long id = p.getID(); if (id == PropertyIDMap.PID_CODEPAGE) { cps.setCodepage((Integer)p.getValue()); } else if (id > PropertyIDMap.PID_CODEPAGE) { propertyCount++; final CustomProperty cp = new CustomProperty(p, dictionary.get(id)); cps.put(cp.getName(), cp); } } if (cps.size() != propertyCount) { cps.setPure(false); } } return cps; }