Package org.docx4j.relationships

Examples of org.docx4j.relationships.Relationships


      Base sourcePart,
      Base targetPart,
      Set<String> relationshipTypes) throws Docx4JException {
   
    RelationshipsPart sourceRelationshipsPart = sourcePart.getRelationshipsPart(false);
    Relationships sourceRelationships = (sourceRelationshipsPart != null ?
                          sourceRelationshipsPart.getRelationships() :
                     null);
    List<Relationship> sourceRelationshipList = (sourceRelationships != null ?
                              sourceRelationships.getRelationship() :
                           null);
   
    RelationshipsPart targetRelationshipsPart = null;
    Relationships targetRelationships = null;
   
    Relationship sourceRelationship = null;
    Relationship targetRelationship = null;
   
    Part sourceChild = null;
    Part targetChild = null;
   
    if ((sourceRelationshipList != null) &&
      (!sourceRelationshipList.isEmpty())) {
     
      targetRelationshipsPart = targetPart.getRelationshipsPart(); //create if needed
      targetRelationships = targetRelationshipsPart.getRelationships();
     
      for (int i=0; i<sourceRelationshipList.size(); i++) {
       
        sourceRelationship = sourceRelationshipList.get(i);
        //the Relationship doesn't have any references to parts, therefore it can be reused
        targetRelationships.getRelationship().add(sourceRelationship);
       
        if (sourceRelationship.getTargetMode()==null
            // per ECMA 376 4ed Part 2, capitalisation should be thus: "External"
            // but we can relax this..
            || !"external".equals(sourceRelationship.getTargetMode().toLowerCase())) {
View Full Code Here


   
    // Change the rels to TargetMode="External"
    // Fetch rels part
    MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();
    RelationshipsPart relsPart = documentPart.getRelationshipsPart();
    Relationships rels = relsPart.getRelationships();
    List<Relationship> relsList = rels.getRelationship();
   
    // For each image rel
    for (Relationship r : relsList) {

      System.out.println(r.getTargetMode());
View Full Code Here

TOP

Related Classes of org.docx4j.relationships.Relationships

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.