Class RepeatDocPartProcessor

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

public class RepeatDocPartProcessor extends BaseCommentProcessor implements IRepeatDocPartProcessor
This class is responsible for processing the <ds:repeat> tag. It uses the OpcStamper to stamp the sub document and then copies the resulting sub document to the correct position in the main document.
Version:
1.6.6
Author:
Joseph Verron
  • Method Details

    • newInstance

      public static ICommentProcessor newInstance(PlaceholderReplacer pr, OpcStamper<org.docx4j.openpackaging.packages.WordprocessingMLPackage> stamper, String nullReplacementValue)

      newInstance.

      Parameters:
      pr - the placeholder replacer
      stamper - the stamper
      nullReplacementValue - the value to use when the placeholder is null
      Returns:
      a new instance of this processor
    • newInstance

      public static ICommentProcessor newInstance(PlaceholderReplacer pr, OpcStamper<org.docx4j.openpackaging.packages.WordprocessingMLPackage> stamper)

      newInstance.

      Parameters:
      pr - the placeholder replacer
      stamper - the stamper
      Returns:
      a new instance of this processor
    • repeatDocPart

      public void repeatDocPart(List<Object> contexts)
      May be called to mark a document part 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:
      repeatDocPart in interface IRepeatDocPartProcessor
      Parameters:
      contexts - 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