public void remove(PartName partName) { if (get(partName) != null) { log.info("Deleting part " + partName); parts.remove(partName); } else { log.error("Couldn't delete part " + partName + " - nothing by that name"); } }
log.info("adding part with proposed name: " + newPartName.getName()); if (this.getPackage().getParts().get( newPartName )!=null) { part = this.getPackage().getParts().get( newPartName ); if (this.getPackage().getParts().get( newPartName )!=null && mode.equals(AddPartBehaviour.OVERWRITE_IF_NAME_EXISTS)) { if (this.getPackage().getParts().get( newPartName )!=null) {
public void put(Part part) { if (get(part.getPartName()) != null) { log.info("Overwriting existing part " + part.getPartName()); } else { log.debug("put part " + part.getPartName()); } parts.put(part.getPartName(), part); }
/** * @param parts The parts present in the package to which this will be added. * If for example /customXml/item1.xml already exists, this allows * the name /customXml/item2.xml to be generated. * @throws InvalidFormatException */ @Deprecated // since we now have AddPartBehaviour.RENAME_IF_NAME_EXISTS public CustomXmlDataStoragePart(Parts parts) throws InvalidFormatException { int partNum = 1; if (parts!=null) { while (parts.get(new PartName("/customXml/item" + partNum + ".xml"))!=null) { partNum++; } } this.setPartName(new PartName("/customXml/item" + partNum + ".xml")); log.info("Using PartName /customXml/item" + partNum + ".xml"); init(); }
throw new IllegalArgumentException("partName was null"); Part part = getPackage().getParts().get(partName);
protected static Part deepCopyPart(OpcPackage opcPackage, Base targetParent, Part sourcePart, Set<String> relationshipTypes) throws Docx4JException { //check if already handled Part ret = opcPackage.getParts().get(sourcePart.getPartName()); if (ret == null) { // ret = copyPart(sourcePart, opcPackage, ((relationshipTypes == null) || relationshipTypes.contains(sourcePart.getRelationshipType())) ); opcPackage.getParts().put(ret); targetParent.setPartShortcut(ret, ret.getRelationshipType()); } return ret; }
log.debug("Getting part /" + resolvedPartUri ); Part part = packageIn.getParts().get(new PartName("/" + resolvedPartUri));
return getPackage().getParts().get( new PartName(uri, true )); } catch (InvalidFormatException e) { log.error("Couldn't get part using PartName: " + uri, e);
JaxbXmlPartAltChunkHost clonedPart = (JaxbXmlPartAltChunkHost)clonePkg.getParts().get(partName);
Part parentPart = otherPackage.getParts().get(a.getSourcePartName()); if (a.getPart().getContentType().equals(ContentTypes.RELATIONSHIPS_PART)) { parentPart.setRelationships(null); Part parentPart = otherPackage.getParts().get(a.getSourcePartName()); newRP = parentPart.getRelationshipsPart(true); Part targetPart = otherPackage.getParts().get( new PartName(a.getPart().getName())); Part parentPart = otherPackage.getParts().get(a.getSourcePartName()); newRP = parentPart.getRelationshipsPart(true); Part parentPart = otherPackage.getParts().get(a.getSourcePartName()); Part newPart = FlatOpcXmlImporter.getRawPart(otherPackage.getContentTypeManager(), a.getPart(), null);
public void remove(PartName partName) { if (get(partName) != null) { log.info("Deleting part " + partName); parts.remove(partName); } else { log.error("Couldn't delete part " + partName + " - nothing by that name"); } }
public void put(Part part) { if (get(part.getPartName()) != null) { log.info("Overwriting existing part " + part.getPartName()); } else { log.debug("put part " + part.getPartName()); } parts.put(part.getPartName(), part); }
/** * @param parts The parts present in the package to which this will be added. * If for example /customXml/item1.xml already exists, this allows * the name /customXml/item2.xml to be generated. * @throws InvalidFormatException */ @Deprecated // since we now have AddPartBehaviour.RENAME_IF_NAME_EXISTS public CustomXmlDataStoragePart(Parts parts) throws InvalidFormatException { int partNum = 1; if (parts!=null) { while (parts.get(new PartName("/customXml/item" + partNum + ".xml"))!=null) { partNum++; } } this.setPartName(new PartName("/customXml/item" + partNum + ".xml")); log.info("Using PartName /customXml/item" + partNum + ".xml"); init(); }
protected CTCalcChain getCalculationChain() { CTCalcChain calculationChain = null; try { CalcChain part = (CalcChain) result.getPackage().getParts().get(new PartName("/xl/calcChain.xml")); if (part != null) { try { calculationChain = part.getContents(); } catch (Docx4JException e) { throw new RuntimeException("Unable to get contents of part", e); } calculationChain.getC().clear(); } } catch (InvalidFormatException e) { //do nothing } return calculationChain; }
protected CTCalcChain getCalculationChain() { CTCalcChain calculationChain = null; try { CalcChain part = (CalcChain) result.getPackage().getParts().get(new PartName("/xl/calcChain.xml")); if (part != null) { calculationChain = part.getJaxbElement(); calculationChain.getC().clear(); } } catch (InvalidFormatException e) { //do nothing } return calculationChain; }
private static void collectComments(final Map<BigInteger, CommentWrapper> comments, WordprocessingMLPackage document) { try { CommentsPart commentsPart = (CommentsPart) document.getParts() .get(new PartName("/word/comments.xml")); if (commentsPart != null) { for (Comments.Comment comment : commentsPart.getContents().getComment()) { CommentWrapper commentWrapper = comments.get(comment.getId()); if (commentWrapper != null) { commentWrapper.setComment(comment); } } } } catch (Docx4JException e) { throw new IllegalStateException(e); } }
throw new IllegalArgumentException("partName was null"); Part part = getPackage().getParts().get(partName);
protected static Part deepCopyPart(OpcPackage opcPackage, Base targetParent, Part sourcePart, Set<String> relationshipTypes) throws Docx4JException { //check if already handled Part ret = opcPackage.getParts().get(sourcePart.getPartName()); if (ret == null) { // ret = copyPart(sourcePart, opcPackage, ((relationshipTypes == null) || relationshipTypes.contains(sourcePart.getRelationshipType())) ); opcPackage.getParts().put(ret); targetParent.setPartShortcut(ret, ret.getRelationshipType()); } return ret; }
BigInteger id = ((CommentRangeStart) contentObject).getId(); CommentsPart commentsPart = (CommentsPart) document.getParts() .get(new PartName("/word/comments.xml")); Comments comments = commentsPart.getContents(); for (Comments.Comment comment : comments.getComment()) {
return getPackage().getParts().get( new PartName(uri, true )); } catch (InvalidFormatException e) { log.error("Couldn't get part using PartName: " + uri, e);