public StyleDefinitionsPart getStyleDefinitionsPart(boolean create) { if (styleDefinitionsPart==null && create) { // HTML, PDF output won't work without this log.info("No StyleDefinitionsPart detected. Adding default part."); try { styleDefinitionsPart = new StyleDefinitionsPart(); styleDefinitionsPart.unmarshalDefaultStyles(); this.addTargetPart(styleDefinitionsPart); } catch (Exception e) { log.error(e.getMessage(), e); } } return styleDefinitionsPart; }
/** * Does this package contain an endnotes part, with real endnotes * in it? * @return */ public boolean hasEndnotesPart() { if (getEndNotesPart()==null) { return false; } else { // Word seems to add an endnotes part when it adds a footnotes part, // so existence of part is not determinative CTEndnotes endnotes = getEndNotesPart().getJaxbElement(); if (endnotes.getEndnote().size()<3) { // id's 0 & 1 are: // <w:endnote w:type="separator" w:id="0"> // <w:endnote w:type="continuationSeparator" w:id="1"> return false; } return true; } }
public boolean hasFootnotesPart() { if (getFootnotesPart()==null) { return false; } else { return true; } }
@Override public boolean setPartShortcut(Part part, String relationshipType) { if (relationshipType.equals(Namespaces.GLOSSARY_DOCUMENT)) { glossaryDocumentPart = (GlossaryDocumentPart)part; return true; } else { return super.setPartShortcut(part, relationshipType); } }
public StyleDefinitionsPart getStyleDefinitionsPart() { return getStyleDefinitionsPart(false); }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.FONT_TABLE)) { fontTablePart = (FontTablePart)part; return true; } else if (relationshipType.equals(Namespaces.THEME)) { themePart = (ThemePart)part; return true; } else if (relationshipType.equals(Namespaces.STYLES)) { styleDefinitionsPart = (StyleDefinitionsPart)part; return true; } else if (relationshipType.equals(Namespaces.WEB_SETTINGS)) { webSettingsPart = (WebSettingsPart)part; return true; } else if (relationshipType.equals(Namespaces.SETTINGS)) { documentSettingsPart = (DocumentSettingsPart)part; return true;
public StyleDefinitionsPart getStyleDefinitionsPart() { return getStyleDefinitionsPart(false); }
@Override public boolean setPartShortcut(Part part, String relationshipType) { if (relationshipType.equals(Namespaces.GLOSSARY_DOCUMENT)) { glossaryDocumentPart = (GlossaryDocumentPart)part; return true; } else { return super.setPartShortcut(part, relationshipType); } }
/** * @param createIfAbsent * @return * @throws InvalidFormatException * @since 3.3.0 */ public DocumentSettingsPart getDocumentSettingsPart(boolean createIfAbsent) throws InvalidFormatException { if (documentSettingsPart==null) { if (createIfAbsent) { documentSettingsPart = new DocumentSettingsPart(); this.addTargetPart(documentSettingsPart); documentSettingsPart.setContents(new CTSettings()); } else { return null; } } return documentSettingsPart; }
public boolean hasFootnotesPart() { if (getFootnotesPart()==null) { return false; } else { return true; } }
/** * Does this package contain an endnotes part, with real endnotes * in it? * @return */ public boolean hasEndnotesPart() { if (getEndNotesPart()==null) { return false; } else { // Word seems to add an endnotes part when it adds a footnotes part, // so existence of part is not determinative CTEndnotes endnotes = getEndNotesPart().getJaxbElement(); if (endnotes.getEndnote().size()<3) { // id's 0 & 1 are: // <w:endnote w:type="separator" w:id="0"> // <w:endnote w:type="continuationSeparator" w:id="1"> return false; } return true; } }
public boolean setPartShortcut(Part part, String relationshipType) { // Since each part knows its relationshipsType, // why is this passed in as an arg? // Answer: where the relationshipType is ascertained // from the rel itself, it is the most authoritative. // Note that we normally use the info in [Content_Types] // to create a part of the correct type. This info // will not necessary correspond to the info in the rel! if (relationshipType==null) { log.warn("trying to set part shortcut against a null relationship type."); return false; } if (relationshipType.equals(Namespaces.FONT_TABLE)) { fontTablePart = (FontTablePart)part; return true; } else if (relationshipType.equals(Namespaces.THEME)) { themePart = (ThemePart)part; return true; } else if (relationshipType.equals(Namespaces.STYLES)) { styleDefinitionsPart = (StyleDefinitionsPart)part; return true; } else if (relationshipType.equals(Namespaces.WEB_SETTINGS)) { webSettingsPart = (WebSettingsPart)part; return true; } else if (relationshipType.equals(Namespaces.SETTINGS)) { documentSettingsPart = (DocumentSettingsPart)part; return true;
public StyleDefinitionsPart getStyleDefinitionsPart(boolean create) { if (styleDefinitionsPart==null && create) { // HTML, PDF output won't work without this log.info("No StyleDefinitionsPart detected. Adding default part."); try { styleDefinitionsPart = new StyleDefinitionsPart(); styleDefinitionsPart.unmarshalDefaultStyles(); this.addTargetPart(styleDefinitionsPart); } catch (Exception e) { log.error(e.getMessage(), e); } } return styleDefinitionsPart; }
/** * @param createIfAbsent * @return * @throws InvalidFormatException * @since 3.3.0 */ public DocumentSettingsPart getDocumentSettingsPart(boolean createIfAbsent) throws InvalidFormatException { if (documentSettingsPart==null) { if (createIfAbsent) { documentSettingsPart = new DocumentSettingsPart(); this.addTargetPart(documentSettingsPart); documentSettingsPart.setContents(new CTSettings()); } else { return null; } } return documentSettingsPart; }