Class XLSFormatter

java.lang.Object
io.jmix.reports.yarg.formatters.impl.AbstractFormatter
io.jmix.reports.yarg.formatters.impl.XLSFormatter
All Implemented Interfaces:
ReportFormatter

public class XLSFormatter extends AbstractFormatter
Document formatter for '.xls' file types
  • Field Details

    • DYNAMIC_HEIGHT_STYLE

      protected static final String DYNAMIC_HEIGHT_STYLE
      See Also:
    • templateWorkbook

      protected org.apache.poi.hssf.usermodel.HSSFWorkbook templateWorkbook
    • resultWorkbook

      protected org.apache.poi.hssf.usermodel.HSSFWorkbook resultWorkbook
    • currentTemplateSheet

      protected org.apache.poi.hssf.usermodel.HSSFSheet currentTemplateSheet
    • fontCache

      protected XlsFontCache fontCache
    • styleCache

      protected XlsStyleCache styleCache
    • rownum

      protected int rownum
    • colnum

      protected int colnum
    • rowsAddedByVerticalBand

      protected int rowsAddedByVerticalBand
    • rowsAddedByHorizontalBand

      protected int rowsAddedByHorizontalBand
    • mergeRegionsForRangeNames

      protected Map<String,List<XLSFormatter.SheetRange>> mergeRegionsForRangeNames
    • templateToResultSheetsMapping

      protected Map<org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.HSSFSheet> templateToResultSheetsMapping
    • templateBounds

      protected Map<String,XLSFormatter.Bounds> templateBounds
    • areaDependencyManager

      protected AreaDependencyManager areaDependencyManager
    • areasDependency

      protected Map<Area,List<Area>> areasDependency
    • orderedPicturesId

      protected List<Integer> orderedPicturesId
    • sheetToEscherAggregate

      protected Map<String,org.apache.poi.hssf.record.EscherAggregate> sheetToEscherAggregate
    • drawingPatriarchsMap

      protected Map<org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.HSSFPatriarch> drawingPatriarchsMap
    • hints

      protected List<XlsHint> hints
    • documentConverter

      protected DocumentConverter documentConverter
    • bandsToResultRanges

      protected com.google.common.collect.BiMap<BandData,Range> bandsToResultRanges
  • Constructor Details

  • Method Details

    • setDocumentConverter

      public void setDocumentConverter(DocumentConverter documentConverter)
    • renderDocument

      public void renderDocument()
      Description copied from interface: ReportFormatter
      Creates document and serializes it to predefined stream (or something like this)
    • initWorkbook

      protected void initWorkbook()
    • initNamedStyleCache

      protected void initNamedStyleCache()
    • processDocument

      protected void processDocument()
    • applyHints

      protected void applyHints()
    • outputDocument

      protected void outputDocument()
    • copyPicturesToResultWorkbook

      protected void copyPicturesToResultWorkbook()
    • removeMergedRegions

      protected void removeMergedRegions(org.apache.poi.hssf.usermodel.HSSFSheet resultSheet)
    • cleanupCells

      protected void cleanupCells(org.apache.poi.hssf.usermodel.HSSFSheet resultSheet)
    • copyCharts

      protected void copyCharts(org.apache.poi.hssf.usermodel.HSSFSheet resultSheet)
    • updateFormulas

      protected void updateFormulas()
    • copyPictures

      protected void copyPictures()
    • writeBand

      protected void writeBand(BandData band)
    • writeHorizontalBand

      protected void writeHorizontalBand(BandData band, org.apache.poi.hssf.usermodel.HSSFSheet templateSheet, org.apache.poi.hssf.usermodel.HSSFSheet resultSheet)
      Method writes horizontal band Note: Only one band for row is supported. Now we think that many bands for row aren't usable.
      Parameters:
      band - - band to write
      templateSheet - - template sheet
      resultSheet - - result sheet
    • writeVerticalBand

      protected void writeVerticalBand(BandData band, org.apache.poi.hssf.usermodel.HSSFSheet templateSheet, org.apache.poi.hssf.usermodel.HSSFSheet resultSheet)
      Method writes vertical band Note: no child support for vertical band ;)
      Parameters:
      band - - band to write
      templateSheet - - template sheet
      resultSheet - - result sheet
    • initMergeRegions

      protected void initMergeRegions(org.apache.poi.hssf.usermodel.HSSFSheet currentSheet)
      Method creates mapping [rangeName : List<CellRangeAddress>]. List contains all merge regions for this named range. Attention: if merged regions writes wrong - look on methods isMergeRegionInsideNamedRange or isNamedRangeInsideMergeRegion todo: how to recognize if merge region must be copied with named range
      Parameters:
      currentSheet - Sheet which contains merge regions
    • copyMergeRegions

      protected void copyMergeRegions(org.apache.poi.hssf.usermodel.HSSFSheet resultSheet, String rangeName, int firstTargetRangeRow, int firstTargetRangeColumn)
      Create new merge regions in result sheet identically to range's merge regions from template. Not support copy of frames and rules
      Parameters:
      resultSheet - - result sheet
      rangeName - - range name
      firstTargetRangeRow - - first column of target range
      firstTargetRangeColumn - - first column of target range
    • intersects

      protected boolean intersects(org.apache.poi.ss.util.CellRangeAddress x, org.apache.poi.ss.util.CellRangeAddress y)
    • updateValueCell

      protected void updateValueCell(BandData rootBand, BandData bandData, String templateCellValue, org.apache.poi.hssf.usermodel.HSSFCell resultCell, org.apache.poi.hssf.usermodel.HSSFPatriarch patriarch)
      Copies template cell to result cell and fills it with bandData data
      Parameters:
      bandData - - bandData
      templateCellValue - - template cell value
      resultCell - - result cell
    • setValueToCell

      protected void setValueToCell(org.apache.poi.hssf.usermodel.HSSFCell resultCell, String cellValue, org.apache.poi.ss.usermodel.CellType cellType)
    • inlineBandDataToCellString

      protected String inlineBandDataToCellString(org.apache.poi.hssf.usermodel.HSSFCell cell, String templateCellValue, BandData band)
    • addRangeBounds

      protected void addRangeBounds(BandData band, org.apache.poi.ss.util.CellReference[] crefs)
      This method adds range bounds to cache. Key is bandName
      Parameters:
      band - - band
      crefs - - range
    • updateFormulas

      protected void updateFormulas(Area templateArea, Area dependentResultArea)
    • extractStyles

      protected String extractStyles(org.apache.poi.hssf.usermodel.HSSFCell templateCell, org.apache.poi.hssf.usermodel.HSSFCell resultCell, String templateCellValue, BandData bandData)
    • copyCellStyle

      protected org.apache.poi.hssf.usermodel.HSSFCellStyle copyCellStyle(org.apache.poi.hssf.usermodel.HSSFCellStyle templateStyle)
    • getEscherAggregate

      protected org.apache.poi.hssf.record.EscherAggregate getEscherAggregate(org.apache.poi.hssf.usermodel.HSSFSheet sheet)
      Returns EscherAggregate from sheet
      Parameters:
      sheet - - HSSFSheet
      Returns:
      - EscherAggregate from sheet
    • copyPicturesFromTemplateToResult

      protected void copyPicturesFromTemplateToResult(org.apache.poi.hssf.usermodel.HSSFSheet templateSheet, org.apache.poi.hssf.usermodel.HSSFSheet resultSheet)
      Copies all pictures from template sheet to result sheet, shift picture depending on area dependencies
      Parameters:
      templateSheet - - template sheet
      resultSheet - - result sheet
    • rowExists

      protected boolean rowExists(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int rowNumber)
    • getCellFromTemplate

      protected Cell getCellFromTemplate(Cell cell)
    • updateCell

      protected void updateCell(Cell cell)
    • copyPageBreaks

      protected void copyPageBreaks(org.apache.poi.hssf.usermodel.HSSFSheet templateSheet, org.apache.poi.hssf.usermodel.HSSFSheet resultSheet, int templateRowIndex, int resultRowIndex)