Class StreamingXlsxToCsvWriter.SheetToCsvHandler

java.lang.Object
org.xml.sax.helpers.DefaultHandler
io.jmix.reports.yarg.formatters.impl.streaming.StreamingXlsxToCsvWriter.SheetToCsvHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Enclosing class:
StreamingXlsxToCsvWriter

protected static class StreamingXlsxToCsvWriter.SheetToCsvHandler extends DefaultHandler
  • Field Details

    • writer

      protected final com.opencsv.CSVWriter writer
    • currentRow

      protected final List<String> currentRow
    • currentValue

      protected final StringBuilder currentValue
    • inValue

      protected boolean inValue
    • cellHasValue

      protected boolean cellHasValue
    • cellHasFormula

      protected boolean cellHasFormula
    • currentColumn

      protected int currentColumn
    • currentCellType

      protected @Nullable String currentCellType
  • Constructor Details

    • SheetToCsvHandler

      protected SheetToCsvHandler(com.opencsv.CSVWriter writer)
  • Method Details

    • startElement

      public void startElement(String uri, String localName, String qName, Attributes attributes)
      Specified by:
      startElement in interface ContentHandler
      Overrides:
      startElement in class DefaultHandler
    • characters

      public void characters(char[] ch, int start, int length)
      Specified by:
      characters in interface ContentHandler
      Overrides:
      characters in class DefaultHandler
    • endElement

      public void endElement(String uri, String localName, String qName)
      Specified by:
      endElement in interface ContentHandler
      Overrides:
      endElement in class DefaultHandler
    • columnIndex

      protected int columnIndex(@Nullable String cellRef)
      Column index (0-based) parsed from a cell reference such as B3, or -1 when absent.
    • isNumericType

      protected boolean isNumericType(@Nullable String type)
      A numeric cell has no t attribute or t="n"; strings/booleans/errors carry a type.
    • formatNumeric

      protected String formatNumeric(String raw)
      Normalizes a numeric <v> read back from the streamed workbook: a whole number without a trailing .0 and never in scientific notation (the workbook stores every number as a double, so a plain integer would otherwise come out as 5.0 or 1.2E12). Values beyond the exact-integer range of a double keep whatever precision the double preserved. This is close to, but not byte-identical with, the non-streaming engine's raw cell.getV() output (see the class Javadoc).