Class ParagraphStylesInTableFix.StyleRenamer

java.lang.Object
org.docx4j.TraversalUtil.CallbackImpl
org.docx4j.convert.out.common.preprocess.ParagraphStylesInTableFix.StyleRenamer
All Implemented Interfaces:
TraversalUtil.Callback
Enclosing class:
ParagraphStylesInTableFix

public static class ParagraphStylesInTableFix.StyleRenamer extends TraversalUtil.CallbackImpl
  • Field Details

    • log

      protected static org.slf4j.Logger log
    • overrideTableStyleFontSizeAndJustification

      CTCompatSetting overrideTableStyleFontSizeAndJustification
    • propertyResolver

      private PropertyResolver propertyResolver
    • defaultParagraphStyle

      private String defaultParagraphStyle
    • defaultTableStyle

      private Style defaultTableStyle
    • tblStack

      private LinkedList<Tbl> tblStack
    • allStyles

      private Map<String,Style> allStyles
    • cellPStyles

      private Set<String> cellPStyles
  • Constructor Details

    • StyleRenamer

      public StyleRenamer()
  • Method Details

    • setDefaultParagraphStyle

      public void setDefaultParagraphStyle(String defaultParagraphStyle)
    • setDefaultTableStyle

      public void setDefaultTableStyle(Style defaultTableStyle)
    • setStyles

      public void setStyles(Styles newStyles)
    • isFalse

      private boolean isFalse(CTCompatSetting overrideTableStyleFontSizeAndJustification)
    • getCellPStyle

      private String getCellPStyle(String styleVal, boolean pStyleIsDefault)
      In a cell, a paragraph uses the table's paragraph properties, plus the relevant paragraph style (Normal, by default). The relevant paragraph style trumps the values from the table's paragraph properties, so that would mean giving the doc defaults (which we've made part of our styles) priority over the table's paragraph properties, which is wrong. TO avoid this, we create a new style, which encapsulates the paragraph style, with DocDefaults given lower priority than table style. This created style has no w:basedOn setting.
    • apply

      public List<Object> apply(Object o)
      Description copied from class: TraversalUtil.CallbackImpl
      Visits a node in pre order (before its children have been visited). A node is visited only if all its parents have been traversed ( TraversalUtil.CallbackImpl.shouldTraverse(Object)).

      Implementations can have side effects.

      Specified by:
      apply in interface TraversalUtil.Callback
      Specified by:
      apply in class TraversalUtil.CallbackImpl
    • walkJAXBElements

      public void walkJAXBElements(Object parent)
      Specified by:
      walkJAXBElements in interface TraversalUtil.Callback
      Overrides:
      walkJAXBElements in class TraversalUtil.CallbackImpl