Class XlsxUtils
java.lang.Object
io.jmix.reports.yarg.formatters.impl.xlsx.XlsxUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.docx4j.openpackaging.parts.DrawingML.DrawingaddCTDrawing(org.docx4j.openpackaging.parts.SpreadsheetML.WorksheetPart worksheetPart, org.docx4j.openpackaging.parts.PartName drawingPart) static org.docx4j.openpackaging.parts.relationships.RelationshipsPartattachImageToCell(org.docx4j.openpackaging.parts.DrawingML.Drawing drawing, Integer col, Integer row, XlsxImage image, String imageRelID) static IntegercomputeColumnIndex(String cellName) static longconvertPxToEmu(long px) static org.docx4j.dml.spreadsheetdrawing.CTPicturecreatePicture(String imageRelID) static voiddeleteCTAnchor(org.apache.poi.xssf.usermodel.XSSFPicture xssfPicture) static StringformatPrintArea(Range printArea, org.apache.poi.ss.SpreadsheetVersion version) Formats a print area as a defined name formula, e.g.static @Nullable RangegetAnchorRange(String sheetName, Object anchor) Returns the cells a drawing object is anchored in: only the anchor cell for an object sized in EMUs, ornullfor an object that is not anchored in cells.static StringgetColumnReferenceFromNumber(int number) static intgetNumberFromColumnReference(String columnReference) static org.docx4j.openpackaging.parts.DrawingML.DrawinggetOrCreateWorksheetDrawing(org.docx4j.openpackaging.packages.SpreadsheetMLPackage pkg, org.docx4j.openpackaging.parts.SpreadsheetML.WorksheetPart worksheetPart) static RangeDependenciesgetRenderedBandBlocks(BandData rootBand, Function<BandData, @Nullable Range> renderedRange, Function<BandData, Range> templateRange) Returns the template range of each rendered band mapped to the range covering the blocks of all its instances.static @Nullable RangeparsePrintArea(@Nullable String formula, org.apache.poi.ss.SpreadsheetVersion version) Parses a print area that is one area of cell references: a rectangle, a cell, whole rows or whole columns, e.g.parsePrintAreas(@Nullable String formula, org.apache.poi.ss.SpreadsheetVersion version) Parses a print area of one or more areas of cell references separated with commas, seeparsePrintArea(String, SpreadsheetVersion).static @Nullable RangerebasePrintArea(Range printArea, RangeDependencies bandBlocks, RangeDependencies objects, org.apache.poi.ss.SpreadsheetVersion version) Re-bases a template print area onto the rendered report.static booleanspansAllColumns(Range range, org.apache.poi.ss.SpreadsheetVersion version) Returns whether the range spans all the columns of the spreadsheet version, i.e.static booleanspansAllRows(Range range, org.apache.poi.ss.SpreadsheetVersion version) Returns whether the range spans all the rows of the spreadsheet version, i.e.static org.apache.poi.ss.util.CellRangeAddresstoCellRangeAddress(Range printArea, org.apache.poi.ss.SpreadsheetVersion version) Converts a print area to a cell range address, e.g.
-
Method Details
-
getNumberFromColumnReference
-
getColumnReferenceFromNumber
-
convertPxToEmu
public static long convertPxToEmu(long px) -
computeColumnIndex
-
createPicture
-
attachImageToCell
-
getOrCreateWorksheetDrawing
public static org.docx4j.openpackaging.parts.DrawingML.Drawing getOrCreateWorksheetDrawing(org.docx4j.openpackaging.packages.SpreadsheetMLPackage pkg, org.docx4j.openpackaging.parts.SpreadsheetML.WorksheetPart worksheetPart) -
addCTDrawing
public static org.docx4j.openpackaging.parts.DrawingML.Drawing addCTDrawing(org.docx4j.openpackaging.parts.SpreadsheetML.WorksheetPart worksheetPart, org.docx4j.openpackaging.parts.PartName drawingPart) throws org.docx4j.openpackaging.exceptions.Docx4JException - Throws:
org.docx4j.openpackaging.exceptions.Docx4JException
-
deleteCTAnchor
public static void deleteCTAnchor(org.apache.poi.xssf.usermodel.XSSFPicture xssfPicture) -
parsePrintArea
public static @Nullable Range parsePrintArea(@Nullable String formula, org.apache.poi.ss.SpreadsheetVersion version) Parses a print area that is one area of cell references: a rectangle, a cell, whole rows or whole columns, e.g.'My sheet'!$A$1:$F$20,Sheet1!$1:$20orSheet1!$A:$F. Whole rows span all the columns and whole columns all the rows of the spreadsheet version. The sheet name is kept the wayRange.fromFormula(String)keeps it: without the enclosing quotes, with the doubled ones inside; it isnullif the formula names no sheet. Returnsnullfor other print areas, e.g. several areas or a formula. -
parsePrintAreas
public static @Nullable List<Range> parsePrintAreas(@Nullable String formula, org.apache.poi.ss.SpreadsheetVersion version) Parses a print area of one or more areas of cell references separated with commas, seeparsePrintArea(String, SpreadsheetVersion). Returnsnullif any of them cannot be parsed, e.g. for a formula. -
spansAllRows
Returns whether the range spans all the rows of the spreadsheet version, i.e. consists of whole columns. -
spansAllColumns
Returns whether the range spans all the columns of the spreadsheet version, i.e. consists of whole rows. -
toCellRangeAddress
public static org.apache.poi.ss.util.CellRangeAddress toCellRangeAddress(Range printArea, org.apache.poi.ss.SpreadsheetVersion version) Converts a print area to a cell range address, e.g. to format it withCellRangeAddress.formatAsString(String, boolean). An area spanning all the columns of the spreadsheet version becomes whole rows, e.g.$1:$20, which also suit applications with fewer columns; an area spanning all the rows becomes whole columns, e.g.$A:$F. -
formatPrintArea
Formats a print area as a defined name formula, e.g.'My sheet'!$A$1:$F$20, seetoCellRangeAddress(Range, SpreadsheetVersion)for whole rows and whole columns. The sheet name is expected the wayparsePrintArea(String, SpreadsheetVersion)returns it. -
getAnchorRange
Returns the cells a drawing object is anchored in: only the anchor cell for an object sized in EMUs, ornullfor an object that is not anchored in cells. -
getRenderedBandBlocks
public static RangeDependencies getRenderedBandBlocks(BandData rootBand, Function<BandData, @Nullable Range> renderedRange, Function<BandData, Range> templateRange) Returns the template range of each rendered band mapped to the range covering the blocks of all its instances. The block of a band instance covers the range it is rendered to and the blocks of its nested bands rendered on the same sheet.- Parameters:
rootBand- root band of the reportrenderedRange- the range a band instance is rendered to, ornullif it is not renderedtemplateRange- the template range of a band, requested with one of its rendered instances
-
rebasePrintArea
public static @Nullable Range rebasePrintArea(Range printArea, RangeDependencies bandBlocks, RangeDependencies objects, org.apache.poi.ss.SpreadsheetVersion version) Re-bases a template print area onto the rendered report.The rows cover everything rendered by the bands that intersect the area, and the objects that intersect it as far as they lie inside it: an object keeps its size, so the part inside the area is covered wherever the object is rendered, from the first row of the sheet on.
The columns cover the columns the content of the area is rendered to: the parts of those bands and objects inside the area, a band with the columns it grows by, e.g. as a vertical band. The area keeps the blank columns it has around its content, unless another band is rendered there. An area spanning all the columns keeps them.
- Parameters:
printArea- print area of the templatebandBlocks- template ranges of the bands mapped to the ranges their instances are rendered to, the rows of their nested bands includedobjects- template ranges of the objects that keep their size, e.g. merged regions and pictures, mapped to the ranges they are rendered toversion- spreadsheet version that limits the number of rows and columns- Returns:
- the print area of the report, or
nullto leave the print area as it is: it spans whole columns, which cover every rendered row anyway, or nothing intersecting it is rendered
-