public final class PropertyTemplate
extends java.lang.Object
A PropertyTemplate
is a template that can be applied to any sheet in
a project. It contains all the border type and color attributes needed to
draw all the borders for a single sheet. That template can be applied to any
sheet in any workbook.
This class requires the full spreadsheet to be in memory, so
SXSSFWorkbook
Spreadsheets are not
supported. The same PropertyTemplate
can, however, be applied to both
HSSFWorkbook
and XSSFWorkbook
objects if necessary. Portions of the border that fall outside the max range
of the Workbook
sheet are ignored.
This would replace RegionUtil
.
Constructor and Description |
---|
PropertyTemplate()
Create a PropertyTemplate object
|
PropertyTemplate(PropertyTemplate template)
Create a PropertyTemplate object from another PropertyTemplate
|
Modifier and Type | Method and Description |
---|---|
void |
applyBorders(Sheet sheet)
Applies the drawn borders to a Sheet.
|
void |
drawBorderColors(CellRangeAddress range,
short color,
BorderExtent extent)
Sets the color for a group of cell borders for a cell range.
|
void |
drawBorders(CellRangeAddress range,
BorderStyle borderType,
BorderExtent extent)
Draws a group of cell borders for a cell range.
|
void |
drawBorders(CellRangeAddress range,
BorderStyle borderType,
short color,
BorderExtent extent)
Draws a group of cell borders for a cell range.
|
BorderStyle |
getBorderStyle(CellAddress cell,
java.lang.String property)
Retrieves the border style for a given cell
|
BorderStyle |
getBorderStyle(int row,
int col,
java.lang.String property)
Retrieves the border style for a given cell
|
int |
getNumBorderColors(CellAddress cell)
Retrieves the number of border colors assigned to a cell
|
int |
getNumBorderColors(int row,
int col)
Retrieves the number of border colors assigned to a cell
|
int |
getNumBorders(CellAddress cell)
Retrieves the number of borders assigned to a cell
|
int |
getNumBorders(int row,
int col)
Retrieves the number of borders assigned to a cell
|
short |
getTemplateProperty(CellAddress cell,
java.lang.String property)
Retrieves the border style for a given cell
|
short |
getTemplateProperty(int row,
int col,
java.lang.String property)
Retrieves the border style for a given cell
|
public PropertyTemplate()
public PropertyTemplate(PropertyTemplate template)
template
- a PropertyTemplate objectpublic void drawBorders(CellRangeAddress range, BorderStyle borderType, BorderExtent extent)
applyBorders(org.apache.poi.ss.usermodel.Sheet)
.range
- - CellRangeAddress
range of cells on which borders are
drawn.borderType
- - Type of border to draw. BorderStyle
.extent
- - BorderExtent
of the borders to be
applied.public void drawBorders(CellRangeAddress range, BorderStyle borderType, short color, BorderExtent extent)
applyBorders(org.apache.poi.ss.usermodel.Sheet)
.range
- - CellRangeAddress
range of cells on which borders are
drawn.borderType
- - Type of border to draw. BorderStyle
.color
- - Color index from IndexedColors
used to draw the
borders.extent
- - BorderExtent
of the borders to be
applied.public void applyBorders(Sheet sheet)
drawBorders(org.apache.poi.ss.util.CellRangeAddress, org.apache.poi.ss.usermodel.BorderStyle, org.apache.poi.ss.usermodel.BorderExtent)
and
drawBorderColors(org.apache.poi.ss.util.CellRangeAddress, short, org.apache.poi.ss.usermodel.BorderExtent)
methods.sheet
- - Sheet
on which to apply borderspublic void drawBorderColors(CellRangeAddress range, short color, BorderExtent extent)
applyBorders(org.apache.poi.ss.usermodel.Sheet)
.range
- - CellRangeAddress
range of cells on which colors are
set.color
- - Color index from IndexedColors
used to draw the
borders.extent
- - BorderExtent
of the borders for which
colors are set.public int getNumBorders(CellAddress cell)
cell
- public int getNumBorders(int row, int col)
row
- col
- public int getNumBorderColors(CellAddress cell)
cell
- public int getNumBorderColors(int row, int col)
row
- col
- public BorderStyle getBorderStyle(CellAddress cell, java.lang.String property)
cell
- property
- public BorderStyle getBorderStyle(int row, int col, java.lang.String property)
row
- col
- property
- public short getTemplateProperty(CellAddress cell, java.lang.String property)
cell
- property
- public short getTemplateProperty(int row, int col, java.lang.String property)
row
- col
- property
- Copyright 2020 The Apache Software Foundation or its licensors, as applicable.