Class XlsxFormatter

java.lang.Object
io.jmix.reports.yarg.formatters.impl.AbstractFormatter
io.jmix.reports.yarg.formatters.impl.XlsxFormatter
All Implemented Interfaces:
ReportFormatter
Direct Known Subclasses:
JmixXlsxFormatter

public class XlsxFormatter extends AbstractFormatter
  • Field Details

    • documentConverter

      protected DocumentConverter documentConverter
    • template

      protected Document template
    • result

      protected Document result
    • rangeDependencies

      protected RangeDependencies rangeDependencies
    • bandsForRanges

      protected BandsForRanges bandsForRanges
    • rangeVerticalIntersections

      protected com.google.common.collect.LinkedHashMultimap<Range,Range> rangeVerticalIntersections
    • innerFormulas

      protected Set<XlsxFormatter.CellWithBand> innerFormulas
    • outerFormulas

      protected Set<XlsxFormatter.CellWithBand> outerFormulas
    • templateImages

      protected Map<String,List<XlsxImage>> templateImages
    • lastRenderedRangeForBandName

      protected Map<String,Range> lastRenderedRangeForBandName
    • lastRowForSheet

      protected Map<org.xlsx4j.sml.Worksheet,Long> lastRowForSheet
    • hintProcessor

      protected XslxHintProcessor hintProcessor
    • previousRangeBandData

      protected BandData previousRangeBandData
    • previousRangesRightOffset

      protected int previousRangesRightOffset
    • formulasPostProcessingEvaluationEnabled

      protected boolean formulasPostProcessingEvaluationEnabled
    • unmarshaller

      protected jakarta.xml.bind.Unmarshaller unmarshaller
    • marshaller

      protected jakarta.xml.bind.Marshaller marshaller
  • Constructor Details

  • Method Details

    • setDocumentConverter

      public void setDocumentConverter(DocumentConverter documentConverter)
    • setFormulasPostProcessingEvaluationEnabled

      public void setFormulasPostProcessingEvaluationEnabled(boolean formulasPostProcessingEvaluationEnabled)
    • renderDocument

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

      protected void validateTemplateContainsNamedRange()
    • saveAndClose

      protected void saveAndClose()
    • isFormulasPostProcessingEvaluationRequired

      protected boolean isFormulasPostProcessingEvaluationRequired()
    • evaluateFormulas

      protected ByteArrayOutputStream evaluateFormulas(byte[] content)
    • isCellInBand

      protected boolean isCellInBand(String sheetName, int row, int col)
    • extractTemplateImages

      public byte[] extractTemplateImages(ReportTemplate reportTemplate)
    • init

      protected void init()
    • findVerticalDependencies

      protected void findVerticalDependencies()
    • updateOutlines

      protected void updateOutlines()
    • updateCharts

      protected void updateCharts()
    • shiftChart

      protected void shiftChart(Document.ChartWrapper chart, Range templateRange, Range firstResultRange)
    • updateFormulas

      protected void updateFormulas()
    • updateConditionalFormatting

      protected void updateConditionalFormatting()
    • processOuterFormulas

      protected void processOuterFormulas()
    • calculateFormulaRangeChange

      protected Range calculateFormulaRangeChange(Range formulaRange, Range templateRange, List<Range> resultRanges)
    • processInnerFormulas

      protected void processInnerFormulas()
    • updateFormula

      protected void updateFormula(org.xlsx4j.sml.Cell cellWithFormula, Range originalFormulaRange, Range formulaRange)
    • calculateOffset

      protected XlsxFormatter.Offset calculateOffset(Range from, Range to)
    • updatePivotTables

      protected void updatePivotTables()
    • updateMergeRegions

      protected void updateMergeRegions()
    • writeBand

      protected void writeBand(BandData childBand)
    • writeHBand

      protected void writeHBand(BandData band)
    • writeVBand

      protected void writeVBand(BandData band)
    • updateRangeMappings

      protected void updateRangeMappings(BandData band, Range templateRange, List<org.xlsx4j.sml.Cell> resultCells)
    • findNextRowForHBand

      protected org.xlsx4j.sml.Row findNextRowForHBand(BandData band, Range templateRange, List<org.xlsx4j.sml.Row> resultSheetRows)
    • findNextRowForVBand

      protected org.xlsx4j.sml.Row findNextRowForVBand(BandData band, Range templateRange, List<org.xlsx4j.sml.Row> resultSheetRows)
    • findNextRowForChildBand

      protected org.xlsx4j.sml.Row findNextRowForChildBand(BandData band, Range templateRange, List<org.xlsx4j.sml.Row> resultSheetRows)
    • findNextRowForFirstRender

      protected org.xlsx4j.sml.Row findNextRowForFirstRender(Range templateRange, List<org.xlsx4j.sml.Row> resultSheetRows)
    • ensureNecessaryRowsCreated

      protected org.xlsx4j.sml.Row ensureNecessaryRowsCreated(Range templateRange, org.xlsx4j.sml.Worksheet resultSheet, org.xlsx4j.sml.Row firstRow)
    • copyCells

      protected List<org.xlsx4j.sml.Cell> copyCells(BandData band, Range templateRange, List<org.xlsx4j.sml.Row> resultSheetRows, org.xlsx4j.sml.Row firstRow, org.xlsx4j.sml.Worksheet resultSheet)
    • createFakeTemplateCellsForEmptyOnes

      protected void createFakeTemplateCellsForEmptyOnes(Range oneRowRange, Map<CellReference,org.xlsx4j.sml.Cell> cellsForOneRowRange, List<org.xlsx4j.sml.Cell> templateCells)
      XLSX document does not store empty cells and it might be an issue for formula calculations and etc. So we need to create fake template cell for each empty cell.
    • getLastRenderedBandForThisLevel

      protected Range getLastRenderedBandForThisLevel(BandData band)
    • getBandRange

      protected Range getBandRange(BandData band)
    • createNewRow

      protected org.xlsx4j.sml.Row createNewRow(org.xlsx4j.sml.Worksheet resultSheet)
    • copyCells

      protected List<org.xlsx4j.sml.Cell> copyCells(Range templateRange, BandData bandData, org.xlsx4j.sml.Row newRow, List<org.xlsx4j.sml.Cell> templateCells)
    • copyCell

      protected org.xlsx4j.sml.Cell copyCell(org.xlsx4j.sml.Cell cell)
    • getWorksheet

      protected org.xlsx4j.sml.Worksheet getWorksheet(org.xlsx4j.sml.Row newRow)
    • getTemplateWorksheet

      protected org.xlsx4j.sml.Worksheet getTemplateWorksheet(org.xlsx4j.sml.Row newRow)
    • addFormulaForPostProcessing

      protected void addFormulaForPostProcessing(Range templateRange, BandData bandData, org.xlsx4j.sml.Row newRow, org.xlsx4j.sml.Cell templateCell, org.xlsx4j.sml.Cell newCell)
    • copyRowSettings

      protected void copyRowSettings(org.xlsx4j.sml.Row templateRow, org.xlsx4j.sml.Row newRow, org.xlsx4j.sml.Worksheet templateWorksheet, org.xlsx4j.sml.Worksheet resultWorksheet)
    • updateCell

      protected void updateCell(org.docx4j.openpackaging.parts.SpreadsheetML.WorksheetPart worksheetPart, BandData bandData, org.xlsx4j.sml.Cell newCell)
    • getFirst

      protected <T> T getFirst(List<T> list)
    • getLast

      protected <T> T getLast(List<T> list)
    • saveXlsxAsCsv

      protected void saveXlsxAsCsv(Document document, OutputStream outputStream) throws IOException, org.docx4j.openpackaging.exceptions.Docx4JException
      Throws:
      IOException
      org.docx4j.openpackaging.exceptions.Docx4JException
    • writeToOutputStream

      protected void writeToOutputStream(org.docx4j.openpackaging.packages.SpreadsheetMLPackage mlPackage, OutputStream outputStream) throws org.docx4j.openpackaging.exceptions.Docx4JException
      Throws:
      org.docx4j.openpackaging.exceptions.Docx4JException
    • updateHeaderAndFooter

      protected void updateHeaderAndFooter()
    • updateSheetNames

      protected void updateSheetNames()
    • insertBandDataToString

      protected String insertBandDataToString(String resultStr)