Ejemplo n.º 1
0
  @Override
  protected void processBookmarks(
      HWPFDocument wordDocument,
      Element currentBlock,
      Range range,
      int currentTableLevel,
      List<Bookmark> rangeBookmarks) {
    Element parent = currentBlock;
    for (Bookmark bookmark : rangeBookmarks) {
      Element bookmarkElement = htmlDocumentFacade.createBookmark(bookmark.getName());
      parent.appendChild(bookmarkElement);
      parent = bookmarkElement;
    }

    if (range != null) processCharacters(wordDocument, currentTableLevel, range, parent);
  }
Ejemplo n.º 2
0
  protected void processNoteAutonumbered(
      HWPFDocument doc, String type, int noteIndex, Element block, Range noteTextRange) {
    final String textIndex = String.valueOf(noteIndex + 1);
    final String textIndexClass =
        htmlDocumentFacade.getOrCreateCssClass("a", "vertical-align:super;font-size:smaller;");
    final String forwardNoteLink = type + "note_" + textIndex;
    final String backwardNoteLink = type + "note_back_" + textIndex;

    Element anchor = htmlDocumentFacade.createHyperlink("#" + forwardNoteLink);
    anchor.setAttribute("name", backwardNoteLink);
    anchor.setAttribute("class", textIndexClass + " " + type + "noteanchor");
    anchor.setTextContent(textIndex);
    block.appendChild(anchor);

    if (notes == null) {
      notes = htmlDocumentFacade.createBlock();
      notes.setAttribute("class", "notes");
    }

    Element note = htmlDocumentFacade.createBlock();
    note.setAttribute("class", type + "note");
    notes.appendChild(note);

    Element bookmark = htmlDocumentFacade.createBookmark(forwardNoteLink);
    bookmark.setAttribute("href", "#" + backwardNoteLink);
    bookmark.setTextContent(textIndex);
    bookmark.setAttribute("class", textIndexClass + " " + type + "noteindex");
    note.appendChild(bookmark);
    note.appendChild(htmlDocumentFacade.createText(" "));

    Element span = htmlDocumentFacade.getDocument().createElement("span");
    span.setAttribute("class", type + "notetext");
    note.appendChild(span);

    this.blocksProperies.add(new BlockProperies("", -1));
    try {
      processCharacters(doc, Integer.MIN_VALUE, noteTextRange, span);
    } finally {
      this.blocksProperies.pop();
    }
  }