Package org.docx4j.relationships

Examples of org.docx4j.relationships.Relationship


      afiPart.setBinaryData(r.getBytes("UTF-8"));
 
      afiPart.setAltChunkType(AltChunkType.Xml); // Flat OPC XML
     
     
      Relationship altChunkRel =sourcePart.addTargetPart(afiPart);
     
      // now that its attached to the package ..
      afiPart.registerInContentTypeManager();
     
 
      CTAltChunk ac = Context.getWmlObjectFactory()
          .createCTAltChunk();
      ac.setId(altChunkRel.getId());

      // This setting makes no difference in that the altChunk
      // still won't use the style from the containing docx
      // if it isn't in the styles part in the altChunk!
     
View Full Code Here


    int partsCountBefore = wordMLPackage.getParts().getParts().size();

    // Add it again
    // Note that we're adding this ELSEWHERE in the pkg for the purposes of this test only
    HeaderPart part2 = new HeaderPart()
    Relationship rel = wordMLPackage.addTargetPart(part2, mode);
    if (mode==AddPartBehaviour.REUSE_EXISTING) {
      // In the REUSE_EXISTING case, we won't be adding this part, so
      // we can't add content to it (since its pkg isn't set)
      part2 = (HeaderPart)wordMLPackage.getRelationshipsPart().getPart(rel);
    }
View Full Code Here

    int partsCountBefore = wordMLPackage.getParts().getParts().size();
   
    // Add it again
    HeaderPart part2 = new HeaderPart();   
    part2.getContent().add(Context.getWmlObjectFactory().createP() );
    Relationship rel = wordMLPackage.getMainDocumentPart().addTargetPart(part2, mode);
   
    // Just added a part
    Assert.assertTrue("hmm", wordMLPackage.getMainDocumentPart().getRelationshipsPart().size()==relsCountBefore+relsAdded);
    Assert.assertTrue("hmm", wordMLPackage.getParts().getParts().size()==partsCountBefore+partsAdded);
   
View Full Code Here

       
        String linkRelId = getDocPr().getHlinkClick().getId();
       
            if ( linkRelId!=null && !linkRelId.equals("") )
            {
              Relationship rel = wmlPackage.getMainDocumentPart().getRelationshipsPart().getRelationshipByID(linkRelId);
             
              if (rel.getTargetMode() == null
                  || rel.getTargetMode().equals("Internal") ) {
               
                setHlinkReference("TODO - save this object");
              } else {
                    setHlinkReference( rel.getTarget() );             
              }
            }
           
            targetFrame = getDocPr().getHlinkClick().getTgtFrame();
            tooltip = getDocPr().getHlinkClick().getTooltip();
View Full Code Here

 
  /** Default build method, get's called with a P.Hyperlink.
   */
  public void build(AbstractWmlConversionContext conversionContext, Object node, Node content) throws TransformerException {
   
    Relationship relationship = null;
    RelationshipsPart rPart = null;
    P.Hyperlink pHyperlink = (P.Hyperlink)node;
   
//    log.debug(XmlUtils.marshaltoString(hyperlink, true, true));
   
    this.content = content;
    setAnchor(pHyperlink.getAnchor());
    setDocLocation(pHyperlink.getDocLocation());
    setRId(pHyperlink.getId());
    setTgtFrame(pHyperlink.getTgtFrame());
    setTooltip(pHyperlink.getTooltip());
    if (conversionContext.getCurrentPart() == null) {
      log.warn("set currentPart (via conversionContext)");
    } else if ((getRId() != null) &&
      (getRId().length() > 0) ) {
      rPart = conversionContext.getCurrentPart().getRelationshipsPart();
      if (rPart == null) {
        log.error("RelationshipsPart is missing!");       
      } else {
        log.debug("looking for rel" + getRId());
        relationship = rPart.getRelationshipByID(getRId());
        if ((relationship != null) &&
          (Namespaces.HYPERLINK.equals(relationship.getType()))) {
          setTarget(relationship.getTarget());
          setExternal("External".equals(relationship.getTargetMode()));
        }
      }
    }
  }
View Full Code Here

        }
       
    }
 
  protected void handleImageRel(ConversionImageHandler imageHandler, String imgRelId, Part sourcePart) {
  Relationship rel = sourcePart.getRelationshipsPart().getRelationshipByID(imgRelId);
  Part part = null;
  String uri = null;
  boolean ignoreImage = false;
    setID(imgRelId);             
   
View Full Code Here

        afiPart.setBinaryData(docxFetcher.getDocxFromIRI(iri));

        afiPart.setContentType(new ContentType(
            "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")); // docx

        Relationship altChunkRel = srcPackage.getMainDocumentPart()
            .addTargetPart(afiPart);
        CTAltChunk ac = Context.getWmlObjectFactory()
            .createCTAltChunk();
        ac.setId(altChunkRel.getId());

        replacements.put(index, ac);

        /*
         * 2011 12 11 TODO.  Rethink support for
View Full Code Here

              ((ContentAccessor)part).getContent(),
              data.get(i), formTextFieldNames )
          ((ContentAccessor)clonedPart).getContent().addAll(newContent);
         
          // Add it
          Relationship rel = target.getMainDocumentPart().addTargetPart(clonedPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS);
         
          // Now add CTRel!
          CTRel newHfRef = XmlUtils.deepCopy(ctRel);
          newHfRef.setId(rel.getId());
         
          thisSection.getEGHdrFtrReferences().add(newHfRef);
         
        }
      }
View Full Code Here

                           null);
   
    RelationshipsPart targetRelationshipsPart = null;
    Relationships targetRelationships = null;
   
    Relationship sourceRelationship = null;
    Relationship targetRelationship = null;
   
    Part sourceChild = null;
    Part targetChild = null;
   
    if ((sourceRelationshipList != null) &&
View Full Code Here

  }
   
  public SldLayoutId addSlideLayoutIdListEntry(SlideLayoutPart slideLayoutPart)
    throws InvalidFormatException {
   
    Relationship rel = this.addTargetPart(slideLayoutPart);
   
    SldLayoutId entry = Context.getpmlObjectFactory().createSlideLayoutIdListSldLayoutId();
   
    entry.setId( new Long(this.getSlideLayoutOrMasterId()) );
    entry.setRid(rel.getId());
   
    this.getJaxbElement().getSldLayoutIdLst().getSldLayoutId().add(entry);
   
    return entry;
  }
View Full Code Here

TOP

Related Classes of org.docx4j.relationships.Relationship

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.