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 object
(模板 - 一个 PropertyTemplate 对象)
public void drawBorders(CellRangeAddress range, BorderStyle borderType, BorderExtent extent)
applyBorders(org.apache.poi.ss.usermodel.Sheet)
.
(为单元格区域绘制一组单元格边框。此时边框不应用于单元格,仅绘制模板。要将绘制的边框应用于工作表,请使用 applyBorders(org.apache.poi.ss.usermodel.Sheet)。)
range
- -
CellRangeAddress
range of cells on which borders are drawn.
(range - - CellRangeAddress 绘制边框的单元格范围。)
borderType
- - Type of border to draw.
BorderStyle
.
(borderType - - 要绘制的边框类型。边框样式。)
extent
- -
BorderExtent
of the borders to be applied.
(extent - 要应用的边框的 BorderExtent。)
public void drawBorders(CellRangeAddress range, BorderStyle borderType, short color, BorderExtent extent)
applyBorders(org.apache.poi.ss.usermodel.Sheet)
.
(为单元格区域绘制一组单元格边框。此时边框不应用于单元格,仅绘制模板。要将绘制的边框应用于工作表,请使用 applyBorders(org.apache.poi.ss.usermodel.Sheet)。)
range
- -
CellRangeAddress
range of cells on which borders are drawn.
(range - - CellRangeAddress 绘制边框的单元格范围。)
borderType
- - Type of border to draw.
BorderStyle
.
(borderType - - 要绘制的边框类型。边框样式。)
color
- - Color index from
IndexedColors
used to draw the borders.
(color - - 来自 IndexedColors 的颜色索引,用于绘制边框。)
extent
- -
BorderExtent
of the borders to be applied.
(extent - 要应用的边框的 BorderExtent。)
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.
(将绘制的边框应用于工作表。应用的边框是由 drawBorders(org.apache.poi.ss.util.CellRangeAddress, org.apache.poi.ss.usermodel.BorderStyle, org.apache.poi.ss.usermodel. BorderExtent) 和 drawBorderColors(org.apache.poi.ss.util.CellRangeAddress, short, org.apache.poi.ss.usermodel.BorderExtent) 方法。)
sheet
- -
Sheet
on which to apply borders
(sheet - - 应用边框的工作表)
public void drawBorderColors(CellRangeAddress range, short color, BorderExtent extent)
applyBorders(org.apache.poi.ss.usermodel.Sheet)
.
(为单元格区域的一组单元格边框设置颜色。此时边框不应用于单元格,仅绘制模板。如果边框不存在,则使用 BORDER_THIN 边框。要将绘制的边框应用于工作表,请使用 applyBorders(org.apache.poi.ss.usermodel.Sheet)。)
range
- -
CellRangeAddress
range of cells on which colors are set.
(range - - CellRangeAddress 设置颜色的单元格范围。)
color
- - Color index from
IndexedColors
used to draw the borders.
(color - - 来自 IndexedColors 的颜色索引,用于绘制边框。)
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 2021 The Apache Software Foundation or its licensors, as applicable.