Package org.docx4j.wml

Examples of org.docx4j.wml.CTBookmark


          @Override
      public List<Object> apply(Object o) {
           
        if (o.getClass().getName().equals(startElement)) {
          if (o instanceof CTBookmark) { // check for special case
            CTBookmark bookmark = (CTBookmark)o;
            if (bookmark.getName().equals("_GoBack")) {
              deletes.add(bookmark);
            } else {
              starts.add(o);             
            }
          } else {
View Full Code Here


  @Override
  public Node toNode(AbstractWmlConversionContext context, Object unmarshalledNode,
      Node modelContent, TransformState state, Document doc)
      throws TransformerException {
  CTBookmark modelData = (CTBookmark)unmarshalledNode;
 
  if (modelData.getName().equals("_GoBack")) {
    return null;
  }
 
    Element ret = doc.createElementNS("http://www.w3.org/1999/XSL/Format", "fo:inline");
    ret.setAttribute("id", modelData.getName());
    return ret;
  }
View Full Code Here

          && ((JAXBElement)child).getName().equals(QNAME_BOOKMARK_START));
    }

    private void appendBookmarksToMove(Object child) {
     
      CTBookmark bm = (CTBookmark)XmlUtils.unwrap(child);
      JAXBElement<CTMarkupRange> jaxbBmEnd = null;
      CTMarkupRange bmEnd = null;
      bookmarksStartToMove.add(child);
   
      //The bookmarkEnd is put directly after a moved bookmarkStart in the paragraph.
      //the corresponding bookmarkEnd is later deleted
      //(this ensures that the bookmarkEnd isn't before the bookmarkStart 
      bmEnd = Context.getWmlObjectFactory().createCTMarkupRange();
      bmEnd.setId(bm.getId());
      jaxbBmEnd = Context.getWmlObjectFactory().createPBookmarkEnd(bmEnd);
      bookmarksStartToMove.add(jaxbBmEnd);
     
      bookmarksEndToRemove.add(bm.getId());
    }
View Full Code Here

    mr.setId(ID);
    JAXBElement<CTMarkupRange> bmEnd = factory.createBodyBookmarkEnd(mr);
    p.getContent().add(index+1, bmEnd);
   
    // Next, bookmark start
    CTBookmark bm = factory.createCTBookmark();
    bm.setId(ID);
    bm.setName(name);   
    JAXBElement<CTBookmark> bmStart =  factory.createBodyBookmarkStart(bm);
    p.getContent().add(index, bmStart);
   
  }
View Full Code Here

  @Override
  public List<Object> apply(Object o) {
   
    if (o.getClass().getName().equals(startElement)) {
      if (o instanceof CTBookmark) {
        CTBookmark bookmark = (CTBookmark)o;
          starts.add(bookmark);
      }
    }
   
    if (o.getClass().getName().equals(endElement)) {
View Full Code Here

      Node modelContent, TransformState state, Document doc)
      throws TransformerException {
   
    if (mapTo.equals("id")) {
     
      CTBookmark modelData = (CTBookmark)unmarshalledNode;
      ((HTMLConversionContext)context).setBookmarkStart(modelData);
      return null;
     
    } else if (mapTo.equals("null")) {

      // do nothing
      return null;
     
    } else {
   
      // the default
      CTBookmark modelData = (CTBookmark)unmarshalledNode;
      Element ret = doc.createElement("a");
      ret.setAttribute("name", modelData.getName());
      return ret;
    }
  }
View Full Code Here

    mr.setId(ID);
    JAXBElement<CTMarkupRange> bmEnd = factory.createBodyBookmarkEnd(mr);
    p.getContent().add(index+1, bmEnd);

    // Next, bookmark start
    CTBookmark bm = factory.createCTBookmark();
    bm.setId(ID);
    bm.setName(name);   
    JAXBElement<CTBookmark> bmStart =  factory.createBodyBookmarkStart(bm);
    p.getContent().add(index, bmStart);
  }
View Full Code Here

TOP

Related Classes of org.docx4j.wml.CTBookmark

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.