/* recursively (i) create new Parts for each thing listed in the relationships (ii) add the new Part to the package (iii) cross the PartName off unusedZipEntries */ private void addPartsFromRelationships(Base source, RelationshipsPart rp, ContentTypeManager ctm) throws Docx4JException { OpcPackage pkg = source.getPackage(); for (Relationship r : rp.getRelationships().getRelationship()) { log.debug( "\n For Relationship Id=" + r.getId() + " Source is " + rp.getSourceP().getPartName() + ", Target is " + r.getTarget() + ", type: " + r.getType()); // This is usually the first logged comment for // a part, so start with a line break. try { getPart(pkg, rp, r, ctm); } catch (Exception e) { throw new Docx4JException("Failed to add parts from relationships", e); } } }
// private void addPartsFromRelationships(ZipFile zf, Base source, RelationshipsPart rp) private void addPartsFromRelationships( HashMap<String, ByteArray> partByteArrays, Base source, RelationshipsPart rp, ContentTypeManager ctm) throws Docx4JException { OpcPackage pkg = source.getPackage(); // for (Iterator it = rp.iterator(); it.hasNext(); ) { // Relationship r = (Relationship)it.next(); // log.info("For Relationship Id=" + r.getId() + " Source is " // + r.getSource().getPartName() // + ", Target is " + r.getTargetURI() ); // try { // // getPart(zf, pkg, rp, r); // // } catch (Exception e) { // throw new Docx4JException("Failed to add parts from relationships", e); // } // } for (Relationship r : rp.getRelationships().getRelationship()) { log.debug( "\n For Relationship Id=" + r.getId() + " Source is " + rp.getSourceP().getPartName() + ", Target is " + r.getTarget() + ", type: " + r.getType()); // This is usually the first logged comment for // a part, so start with a line break. try { getPart(partByteArrays, pkg, rp, r, ctm); } catch (Exception e) { throw new Docx4JException("Failed to add parts from relationships", e); } } }