Class FormattingUtils

java.lang.Object
org.apache.tika.parser.microsoft.FormattingUtils

public class FormattingUtils extends Object
  • Method Details

    • ensureFormattingState

      public static void ensureFormattingState(XHTMLContentHandler xhtml, EnumSet<FormattingUtils.Tag> desired, Deque<FormattingUtils.Tag> currentState) throws SAXException
      Closes all tags until currentState contains only tags from desired set, then open all required tags to reach desired state.
      Parameters:
      xhtml - handler
      desired - desired formatting state
      currentState - current formatting state (stack of open formatting tags)
      Throws:
      SAXException - pass underlying handler exception
    • closeStyleTags

      public static void closeStyleTags(XHTMLContentHandler xhtml, Deque<FormattingUtils.Tag> formattingState) throws SAXException
      Closes all formatting tags.
      Parameters:
      xhtml - handler
      formattingState - current formatting state (stack of open formatting tags)
      Throws:
      SAXException - pass underlying handler exception
    • toTags

      public static EnumSet<FormattingUtils.Tag> toTags(org.apache.poi.wp.usermodel.CharacterRun run)