Class DocumentWalker

java.lang.Object
org.wickedsource.docxstamper.util.walk.DocumentWalker
Direct Known Subclasses:
BaseDocumentWalker

public abstract class DocumentWalker extends Object
This class walks the document and calls abstract methods for each element it encounters. The following elements are supported:
  • P
  • R
  • Tbl
  • Tr
  • Tc
  • CommentRangeStart
  • CommentRangeEnd
  • R.CommentReference
The following elements are not supported:
  • SdtBlock
  • SdtRun
  • SdtElement
  • CTSimpleField
  • CTSdtCell
  • CTSdtContentCell
Version:
${version}
Author:
Joseph Verron
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    DocumentWalker(org.docx4j.wml.ContentAccessor contentAccessor)
    Creates a new DocumentWalker that will traverse the given document.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    onCommentRangeEnd(org.docx4j.wml.CommentRangeEnd commentRangeEnd)
    This method is called for every CommentRangeEnd element in the document.
    protected abstract void
    onCommentRangeStart(org.docx4j.wml.CommentRangeStart commentRangeStart)
    This method is called for every CommentRangeStart element in the document.
    protected abstract void
    onCommentReference(org.docx4j.wml.R.CommentReference commentReference)
    This method is called for every R.CommentReference element in the document.
    protected abstract void
    onParagraph(org.docx4j.wml.P paragraph)
    This method is called for every P element in the document.
    protected abstract void
    onRun(org.docx4j.wml.R run)
    This method is called for every R element in the document.
    protected abstract void
    onTable(org.docx4j.wml.Tbl table)
    This method is called for every Tbl element in the document.
    protected abstract void
    onTableCell(org.docx4j.wml.Tc tableCell)
    This method is called for every Tc element in the document.
    protected abstract void
    onTableRow(org.docx4j.wml.Tr tableRow)
    This method is called for every Tr element in the document.
    void
    Starts the traversal of the document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DocumentWalker

      protected DocumentWalker(org.docx4j.wml.ContentAccessor contentAccessor)
      Creates a new DocumentWalker that will traverse the given document.
      Parameters:
      contentAccessor - the document to traverse.
  • Method Details

    • walk

      public void walk()
      Starts the traversal of the document.
    • onRun

      protected abstract void onRun(org.docx4j.wml.R run)
      This method is called for every R element in the document.
      Parameters:
      run - the R element to process.
    • onParagraph

      protected abstract void onParagraph(org.docx4j.wml.P paragraph)
      This method is called for every P element in the document.
      Parameters:
      paragraph - the P element to process.
    • onTable

      protected abstract void onTable(org.docx4j.wml.Tbl table)
      This method is called for every Tbl element in the document.
      Parameters:
      table - the Tbl element to process.
    • onTableCell

      protected abstract void onTableCell(org.docx4j.wml.Tc tableCell)
      This method is called for every Tc element in the document.
      Parameters:
      tableCell - the Tc element to process.
    • onTableRow

      protected abstract void onTableRow(org.docx4j.wml.Tr tableRow)
      This method is called for every Tr element in the document.
      Parameters:
      tableRow - the Tr element to process.
    • onCommentRangeStart

      protected abstract void onCommentRangeStart(org.docx4j.wml.CommentRangeStart commentRangeStart)
      This method is called for every CommentRangeStart element in the document.
      Parameters:
      commentRangeStart - the CommentRangeStart element to process.
    • onCommentRangeEnd

      protected abstract void onCommentRangeEnd(org.docx4j.wml.CommentRangeEnd commentRangeEnd)
      This method is called for every CommentRangeEnd element in the document.
      Parameters:
      commentRangeEnd - the CommentRangeEnd element to process.
    • onCommentReference

      protected abstract void onCommentReference(org.docx4j.wml.R.CommentReference commentReference)
      This method is called for every R.CommentReference element in the document.
      Parameters:
      commentReference - the R.CommentReference element to process.