Class ParagraphRepeatProcessor

java.lang.Object
org.wickedsource.docxstamper.processor.BaseCommentProcessor
org.wickedsource.docxstamper.processor.repeat.ParagraphRepeatProcessor
All Implemented Interfaces:
ICommentProcessor, IParagraphRepeatProcessor

public class ParagraphRepeatProcessor extends BaseCommentProcessor implements IParagraphRepeatProcessor
This class is used to repeat paragraphs and tables.

It is used internally by the DocxStamper and should not be instantiated by clients.

Version:
1.6.6
Author:
Joseph Verron
  • Method Details

    • newInstance

      public static ICommentProcessor newInstance(PlaceholderReplacer pr, String nullReplacement)

      newInstance.

      Parameters:
      pr - replaces placeholders with values
      nullReplacement - replaces null values
      Returns:
      a new instance of ParagraphRepeatProcessor
    • newInstance

      public static ICommentProcessor newInstance(PlaceholderReplacer placeholderReplacer)

      newInstance.

      Parameters:
      placeholderReplacer - replaces placeholders with values
      Returns:
      a new instance of ParagraphRepeatProcessor
    • getParagraphsInsideComment

      public static Deque<org.docx4j.wml.P> getParagraphsInsideComment(org.docx4j.wml.P paragraph)
      Returns all paragraphs inside the comment of the given paragraph.

      If the paragraph is not inside a comment, the given paragraph is returned.

      Parameters:
      paragraph - the paragraph to analyze
      Returns:
      all paragraphs inside the comment of the given paragraph
    • repeatParagraph

      public void repeatParagraph(List<Object> objects)
      May be called to mark a paragraph to be copied once for each element in the passed-in list. Within each copy of the row, all expressions are evaluated against one of the objects in the list.
      Specified by:
      repeatParagraph in interface IParagraphRepeatProcessor
      Parameters:
      objects - the objects which serve as context root for expressions found in the template table row.
    • commitChanges

      public void commitChanges(org.docx4j.openpackaging.packages.WordprocessingMLPackage document)
      This method is called after all comments in the .docx template have been passed to the comment processor. All manipulations of the .docx document SHOULD BE done in this method. If certain manipulations are already done within in the custom methods of a comment processor, the ongoing iteration over the paragraphs in the document may be disturbed.
      Specified by:
      commitChanges in interface ICommentProcessor
      Parameters:
      document - The Word document that can be manipulated by using the DOCX4J api.
    • reset

      public void reset()
      Resets all state in the comment processor so that it can be re-used in another stamping process.
      Specified by:
      reset in interface ICommentProcessor