/** * 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); } } }
/** * Sets the custom properties. * * @param customProperties The custom properties */ public void setCustomProperties(final CustomProperties customProperties) { ensureSection2(); final Section section = getSections().get(1); final Map<Long,String> dictionary = customProperties.getDictionary(); // section.clear(); /* Set the codepage. If both custom properties and section have a * codepage, the codepage from the custom properties wins, else take the * one that is defined. If none is defined, take ISO-8859-1. */ int cpCodepage = customProperties.getCodepage(); if (cpCodepage < 0) { cpCodepage = section.getCodepage(); } if (cpCodepage < 0) { cpCodepage = Property.DEFAULT_CODEPAGE; } customProperties.setCodepage(cpCodepage); section.setCodepage(cpCodepage); section.setDictionary(dictionary); for (CustomProperty p : customProperties.properties()) { section.setProperty(p); } }
/** * 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>Sets the hidden count.</p> * * @param hiddenCount The hidden count to set. */ public void setHiddenCount(final int hiddenCount) { final MutableSection s = (MutableSection) getSections().get(0); s.setProperty(PropertyIDMap.PID_HIDDENCOUNT, hiddenCount); }
/** * <p>Sets the hidden count.</p> * * @param hiddenCount The hidden count to set. */ public void setHiddenCount(final int hiddenCount) { final MutableSection s = (MutableSection) getSections().get(0); s.setProperty(PropertyIDMap.PID_HIDDENCOUNT, hiddenCount); }
/** * <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."); }
/** * 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); } } }
/** * <p>Sets the custom properties.</p> * * @param customProperties The custom properties */ public void setCustomProperties(final CustomProperties customProperties) { ensureSection2(); final MutableSection section = (MutableSection) getSections().get(1); final Map<Long,String> dictionary = customProperties.getDictionary(); section.clear(); /* Set the codepage. If both custom properties and section have a * codepage, the codepage from the custom properties wins, else take the * one that is defined. If none is defined, take Unicode. */ int cpCodepage = customProperties.getCodepage(); if (cpCodepage < 0) cpCodepage = section.getCodepage(); if (cpCodepage < 0) cpCodepage = Constants.CP_UNICODE; customProperties.setCodepage(cpCodepage); section.setCodepage(cpCodepage); section.setDictionary(dictionary); for (final Iterator<CustomProperty> i = customProperties.values().iterator(); i.hasNext();) { final Property p = i.next(); section.setProperty(p); } }
/** * <p>Sets the custom properties.</p> * * @param customProperties The custom properties */ public void setCustomProperties(final CustomProperties customProperties) { ensureSection2(); final MutableSection section = (MutableSection) getSections().get(1); final Map<Long,String> dictionary = customProperties.getDictionary(); section.clear(); /* Set the codepage. If both custom properties and section have a * codepage, the codepage from the custom properties wins, else take the * one that is defined. If none is defined, take Unicode. */ int cpCodepage = customProperties.getCodepage(); if (cpCodepage < 0) cpCodepage = section.getCodepage(); if (cpCodepage < 0) cpCodepage = Constants.CP_UNICODE; customProperties.setCodepage(cpCodepage); section.setCodepage(cpCodepage); section.setDictionary(dictionary); for (final Iterator<CustomProperty> i = customProperties.values().iterator(); i.hasNext();) { final Property p = i.next(); section.setProperty(p); } }
final Section section = (Section) getSections().get(1); final Map<Long,String> dictionary = section.getDictionary(); final Property[] properties = section.getProperties();
final Section section = (Section) getSections().get(1); final Map<Long,String> dictionary = section.getDictionary(); final Property[] properties = section.getProperties();
System.out.println("TP: "+tp.getPieceDescriptor().isUnicode()); for( Object os : doc.getDocumentSummaryInformation().getSections() ) { Section s = (Section) os; System.out.println("ss# fid: "+s.getFormatID());
System.out.println("TP: "+tp.getPieceDescriptor().isUnicode()); for( Object os : doc.getDocumentSummaryInformation().getSections() ) { Section s = (Section) os; System.out.println("ss# fid: "+s.getFormatID());
/** * Sets the custom properties. * * @param customProperties The custom properties */ public void setCustomProperties(final CustomProperties customProperties) { ensureSection2(); final Section section = getSections().get(1); final Map<Long,String> dictionary = customProperties.getDictionary(); // section.clear(); /* Set the codepage. If both custom properties and section have a * codepage, the codepage from the custom properties wins, else take the * one that is defined. If none is defined, take ISO-8859-1. */ int cpCodepage = customProperties.getCodepage(); if (cpCodepage < 0) { cpCodepage = section.getCodepage(); } if (cpCodepage < 0) { cpCodepage = Property.DEFAULT_CODEPAGE; } customProperties.setCodepage(cpCodepage); section.setCodepage(cpCodepage); section.setDictionary(dictionary); for (CustomProperty p : customProperties.properties()) { section.setProperty(p); } }
/** * 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; }
Section section = (Section)m_documentSummary.getSections().get(0);