Class XLSFormatter
java.lang.Object
io.jmix.reports.yarg.formatters.impl.AbstractFormatter
io.jmix.reports.yarg.formatters.impl.XLSFormatter
- All Implemented Interfaces:
ReportFormatter
Document formatter for '.xls' file types
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classBounds of region [(x,y) : (x1, y1)]protected static classCell range at sheetNested classes/interfaces inherited from class io.jmix.reports.yarg.formatters.impl.AbstractFormatter
AbstractFormatter.BandPathAndParameterName, AbstractFormatter.InlinerAndMatcher -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AreaDependencyManagerprotected intprotected org.apache.poi.hssf.usermodel.HSSFSheetprotected DocumentConverterprotected Map<org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.HSSFPatriarch> protected static final Stringprotected XlsFontCacheprotected Map<String,List<XLSFormatter.SheetRange>> protected org.apache.poi.hssf.usermodel.HSSFWorkbookprotected intprotected intprotected intprotected XlsStyleCacheprotected Map<String,XLSFormatter.Bounds> protected Map<org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.HSSFSheet> protected org.apache.poi.hssf.usermodel.HSSFWorkbookFields inherited from class io.jmix.reports.yarg.formatters.impl.AbstractFormatter
ALIAS_GROUP, ALIAS_WITH_BAND_NAME_PATTERN, ALIAS_WITH_BAND_NAME_REGEXP, BAND_NAME_DECLARATION_PATTERN, BAND_NAME_DECLARATION_REGEXP, contentInliners, defaultFormatProvider, groovyScriptParametersProvider, outputStream, outputType, reportTemplate, rootBand, scripting, SIMPLE_ALIAS_REGEXP, STRING_FUNCTION_GROUP, supportedOutputTypes, UNIVERSAL_ALIAS_PATTERN, UNIVERSAL_ALIAS_REGEXP, VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddRangeBounds(BandData band, org.apache.poi.ss.util.CellReference[] crefs) This method adds range bounds to cache.protected voidprotected voidcleanupCells(org.apache.poi.hssf.usermodel.HSSFSheet resultSheet) protected org.apache.poi.hssf.usermodel.HSSFCellStylecopyCellStyle(org.apache.poi.hssf.usermodel.HSSFCellStyle templateStyle) protected voidcopyCharts(org.apache.poi.hssf.usermodel.HSSFSheet resultSheet) protected voidcopyMergeRegions(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.protected voidcopyPageBreaks(org.apache.poi.hssf.usermodel.HSSFSheet templateSheet, org.apache.poi.hssf.usermodel.HSSFSheet resultSheet, int templateRowIndex, int resultRowIndex) protected voidprotected voidcopyPicturesFromTemplateToResult(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 dependenciesprotected voidprotected StringextractStyles(org.apache.poi.hssf.usermodel.HSSFCell templateCell, org.apache.poi.hssf.usermodel.HSSFCell resultCell, String templateCellValue, BandData bandData) protected CellgetCellFromTemplate(Cell cell) protected org.apache.poi.hssf.record.EscherAggregategetEscherAggregate(org.apache.poi.hssf.usermodel.HSSFSheet sheet) Returns EscherAggregate from sheetprotected voidinitMergeRegions(org.apache.poi.hssf.usermodel.HSSFSheet currentSheet) Method creates mapping [rangeName : List<CellRangeAddress>].protected voidprotected voidprotected StringinlineBandDataToCellString(org.apache.poi.hssf.usermodel.HSSFCell cell, String templateCellValue, BandData band) protected booleanintersects(org.apache.poi.ss.util.CellRangeAddress x, org.apache.poi.ss.util.CellRangeAddress y) protected voidprotected voidprotected voidremoveMergedRegions(org.apache.poi.hssf.usermodel.HSSFSheet resultSheet) voidCreates document and serializes it to predefined stream (or something like this)protected booleanrowExists(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int rowNumber) voidsetDocumentConverter(DocumentConverter documentConverter) protected voidsetValueToCell(org.apache.poi.hssf.usermodel.HSSFCell resultCell, String cellValue, org.apache.poi.ss.usermodel.CellType cellType) protected voidupdateCell(Cell cell) protected voidprotected voidupdateFormulas(Area templateArea, Area dependentResultArea) protected voidupdateValueCell(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 dataprotected voidprotected voidwriteHorizontalBand(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.protected voidwriteVerticalBand(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 ;)Methods inherited from class io.jmix.reports.yarg.formatters.impl.AbstractFormatter
applyStringFunction, checkThreadInterrupted, containsJustOneAlias, createDocument, defaultFormat, findBandByPath, formatValue, formatValue, getAllAliases, getContentInlinerForFormat, getContentInliners, getFormatString, inlineParameterValue, insertBandDataToString, isGroovyScript, separateBandNameAndParameterName, setContentInliners, setDefaultFormatProvider, setScripting, unwrapParameterName, wrapWithReportingException, wrapWithReportingException
-
Field Details
-
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
-
styleCache
-
rownum
protected int rownum -
colnum
protected int colnum -
rowsAddedByVerticalBand
protected int rowsAddedByVerticalBand -
rowsAddedByHorizontalBand
protected int rowsAddedByHorizontalBand -
mergeRegionsForRangeNames
-
templateToResultSheetsMapping
protected Map<org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.HSSFSheet> templateToResultSheetsMapping -
templateBounds
-
areaDependencyManager
-
areasDependency
-
orderedPicturesId
-
sheetToEscherAggregate
-
drawingPatriarchsMap
protected Map<org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi.hssf.usermodel.HSSFPatriarch> drawingPatriarchsMap -
hints
-
documentConverter
-
bandsToResultRanges
-
-
Constructor Details
-
XLSFormatter
-
-
Method Details
-
setDocumentConverter
-
renderDocument
public void renderDocument()Description copied from interface:ReportFormatterCreates 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
-
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 writetemplateSheet- - template sheetresultSheet- - 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 writetemplateSheet- - template sheetresultSheet- - 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 sheetrangeName- - range namefirstTargetRangeRow- - first column of target rangefirstTargetRangeColumn- - 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- - bandDatatemplateCellValue- - template cell valueresultCell- - result cell
-
setValueToCell
protected void setValueToCell(org.apache.poi.hssf.usermodel.HSSFCell resultCell, String cellValue, org.apache.poi.ss.usermodel.CellType cellType) -
inlineBandDataToCellString
-
addRangeBounds
This method adds range bounds to cache. Key is bandName- Parameters:
band- - bandcrefs- - range
-
updateFormulas
-
extractStyles
-
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 sheetresultSheet- - result sheet
-
rowExists
protected boolean rowExists(org.apache.poi.hssf.usermodel.HSSFSheet sheet, int rowNumber) -
getCellFromTemplate
-
updateCell
-
copyPageBreaks
protected void copyPageBreaks(org.apache.poi.hssf.usermodel.HSSFSheet templateSheet, org.apache.poi.hssf.usermodel.HSSFSheet resultSheet, int templateRowIndex, int resultRowIndex)
-