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
org. Spreadsheets are not
supported. The same PropertyTemplate can, however, be applied to both
HSSFWorkbook and org.
objects if necessary. Portions of the border that fall outside the max range
of the Workbook sheet are ignored.
This would replace RegionUtil.
| Modifier and Type | Field and Description |
|---|---|
| private final Map | _propertyTemplate
This is a list of cell properties for one shot application to a range of cells at a later time. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PropertyTemplate(PropertyTemplate
a PropertyTemplate object template)Create a PropertyTemplate object from another PropertyTemplate |
| Modifier and Type | Method and Description |
|---|---|
| private void | addProperty(int row, int col, String property, short value)
Adds a property to this PropertyTemplate for a given cell |
| private void | addProperty(int row, int col, String property, Object value)
Adds a property to this PropertyTemplate for a given cell |
| public void | |
| private static Map | |
| public void | drawBorderColors(CellRangeAddress
- range, short CellRangeAddress range of cells on which colors are
set.- Color index from color, BorderExtent IndexedColors used to draw the
borders.- extent)BorderExtent of the borders for which
colors are set.Sets the color for a group of cell borders for a cell range. |
| public void | drawBorders(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType, BorderExtent BorderStyle.- extent)BorderExtent of the borders to be
applied.Draws a group of cell borders for a cell range. |
| public void | drawBorders(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType, short BorderStyle.- Color index from color, BorderExtent IndexedColors used to draw the
borders.- extent)BorderExtent of the borders to be
applied.Draws a group of cell borders for a cell range. |
| private void | drawBottomBorder(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType)BorderStyle.Draws the bottom border for a range of cells |
| private void | drawBottomBorderColor(CellRangeAddress
- range, short CellRangeAddress range of cells on which colors are
set.- Color index from color)IndexedColors used to draw the
borders.Sets the color of the bottom border for a range of cells. |
| private void | drawHorizontalBorderColors(CellRangeAddress
- range, short CellRangeAddress range of cells on which colors are
set.- Color index from color, BorderExtent IndexedColors used to draw the
borders.- extent)BorderExtent of the borders for which
colors are set. Valid Values are:
Sets the color of the horizontal borders for a range of cells. |
| private void | drawHorizontalBorders(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType, BorderExtent BorderStyle.- extent)BorderExtent of the borders to be
applied. Valid Values are:
Draws the horizontal borders for a range of cells. |
| private void | drawLeftBorder(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType)BorderStyle.Draws the left border for a range of cells |
| private void | drawLeftBorderColor(CellRangeAddress
- range, short CellRangeAddress range of cells on which colors are
set.- Color index from color)IndexedColors used to draw the
borders.Sets the color of the left border for a range of cells. |
| private void | drawOutsideBorderColors(CellRangeAddress
- range, short CellRangeAddress range of cells on which colors are
set.- Color index from color, BorderExtent IndexedColors used to draw the
borders.- extent)BorderExtent of the borders for which
colors are set. Valid Values are:
Sets the color of the outside borders for a range of cells. |
| private void | drawOutsideBorders(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType, BorderExtent BorderStyle.- extent)BorderExtent of the borders to be
applied. Valid Values are:
Draws the outside borders for a range of cells. |
| private void | drawRightBorder(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType)BorderStyle.Draws the right border for a range of cells |
| private void | drawRightBorderColor(CellRangeAddress
- range, short CellRangeAddress range of cells on which colors are
set.- Color index from color)IndexedColors used to draw the
borders.Sets the color of the right border for a range of cells. |
| private void | drawTopBorder(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType)BorderStyle.Draws the top border for a range of cells |
| private void | drawTopBorderColor(CellRangeAddress
- range, short CellRangeAddress range of cells on which colors are
set.- Color index from color)IndexedColors used to draw the
borders.Sets the color of the top border for a range of cells. |
| private void | drawVerticalBorderColors(CellRangeAddress
- range, short CellRangeAddress range of cells on which colors are
set.- Color index from color, BorderExtent IndexedColors used to draw the
borders.- extent)BorderExtent of the borders for which
colors are set. Valid Values are:
Sets the color of the vertical borders for a range of cells. |
| private void | drawVerticalBorders(CellRangeAddress
- range, BorderStyle CellRangeAddress range of cells on which borders are
drawn.- Type of border to draw. borderType, BorderExtent BorderStyle.- extent)BorderExtent of the borders to be
applied. Valid Values are:
Draws the vertical borders for a range of cells. |
| public BorderStyle | |
| public BorderStyle | |
| public int | |
| public int | |
| public int | |
| public int | |
| private static short | |
| private Map | |
| public short | |
| public short | |
| private void | removeBorderColors(CellRangeAddress
- range)CellRangeAddress range of cells to remove borders.Removes all border properties from this PropertyTemplate for the specified range. |
| private void | removeBorders(CellRangeAddress
- range)CellRangeAddress range of cells to remove borders.Removes all border properties from this PropertyTemplate for the specified range. |
| private void | removeProperties(int row, int col, Set<String> properties)
Removes a set of properties from this PropertyTemplate for a given cell |
| _propertyTemplate | back to summary |
|---|---|
| private final Map<CellAddress, Map<String, Object>> _propertyTemplate This is a list of cell properties for one shot application to a range of cells at a later time. | |
| PropertyTemplate | back to summary |
|---|---|
| public PropertyTemplate() Create a PropertyTemplate object | |
| PropertyTemplate | back to summary |
|---|---|
| public PropertyTemplate(PropertyTemplate template) Create a PropertyTemplate object from another PropertyTemplate
| |
| addProperty | back to summary |
|---|---|
| private void addProperty(int row, int col, String property, short value) Adds a property to this PropertyTemplate for a given cell | |
| addProperty | back to summary |
|---|---|
| private void addProperty(int row, int col, String property, Object value) Adds a property to this PropertyTemplate for a given cell | |
| applyBorders | back to summary |
|---|---|
| public void applyBorders(Sheet sheet) Applies the drawn borders to a Sheet. The borders that are applied are
the ones that have been drawn by the | |
| cloneCellProperties | back to summary |
|---|---|
| private static Map | |
| drawBorderColors | back to summary |
|---|---|
| public void drawBorderColors(CellRangeAddress range, short color, BorderExtent extent) Sets the color for a group of cell borders for a cell range. The borders
are not applied to the cells at this time, just the template is drawn. If
the borders do not exist, a BORDER_THIN border is used. To apply the
drawn borders to a sheet, use
| |
| drawBorders | back to summary |
|---|---|
| public void drawBorders(CellRangeAddress range, BorderStyle borderType, BorderExtent extent) Draws a group of cell borders for a cell range. The borders are not
applied to the cells at this time, just the template is drawn. To apply
the drawn borders to a sheet, use
| |
| drawBorders | back to summary |
|---|---|
| public void drawBorders(CellRangeAddress range, BorderStyle borderType, short color, BorderExtent extent) Draws a group of cell borders for a cell range. The borders are not
applied to the cells at this time, just the template is drawn. To apply
the drawn borders to a sheet, use
| |
| drawBottomBorder | back to summary |
|---|---|
| private void drawBottomBorder(CellRangeAddress range, BorderStyle borderType) Draws the bottom border for a range of cells
| |
| drawBottomBorderColor | back to summary |
|---|---|
| private void drawBottomBorderColor(CellRangeAddress range, short color) Sets the color of the bottom border for a range of cells.
| |
| drawHorizontalBorderColors | back to summary |
|---|---|
| private void drawHorizontalBorderColors(CellRangeAddress range, short color, BorderExtent extent) Sets the color of the horizontal borders for a range of cells.
| |
| drawHorizontalBorders | back to summary |
|---|---|
| private void drawHorizontalBorders(CellRangeAddress range, BorderStyle borderType, BorderExtent extent) Draws the horizontal borders for a range of cells.
| |
| drawLeftBorder | back to summary |
|---|---|
| private void drawLeftBorder(CellRangeAddress range, BorderStyle borderType) Draws the left border for a range of cells
| |
| drawLeftBorderColor | back to summary |
|---|---|
| private void drawLeftBorderColor(CellRangeAddress range, short color) Sets the color of the left border for a range of cells.
| |
| drawOutsideBorderColors | back to summary |
|---|---|
| private void drawOutsideBorderColors(CellRangeAddress range, short color, BorderExtent extent) Sets the color of the outside borders for a range of cells.
| |
| drawOutsideBorders | back to summary |
|---|---|
| private void drawOutsideBorders(CellRangeAddress range, BorderStyle borderType, BorderExtent extent) Draws the outside borders for a range of cells.
| |
| drawRightBorder | back to summary |
|---|---|
| private void drawRightBorder(CellRangeAddress range, BorderStyle borderType) Draws the right border for a range of cells
| |
| drawRightBorderColor | back to summary |
|---|---|
| private void drawRightBorderColor(CellRangeAddress range, short color) Sets the color of the right border for a range of cells. If the border is not drawn, it defaults to BORDER_THIN
| |
| drawTopBorder | back to summary |
|---|---|
| private void drawTopBorder(CellRangeAddress range, BorderStyle borderType) Draws the top border for a range of cells
| |
| drawTopBorderColor | back to summary |
|---|---|
| private void drawTopBorderColor(CellRangeAddress range, short color) Sets the color of the top border for a range of cells.
| |
| drawVerticalBorderColors | back to summary |
|---|---|
| private void drawVerticalBorderColors(CellRangeAddress range, short color, BorderExtent extent) Sets the color of the vertical borders for a range of cells.
| |
| drawVerticalBorders | back to summary |
|---|---|
| private void drawVerticalBorders(CellRangeAddress range, BorderStyle borderType, BorderExtent extent) Draws the vertical borders for a range of cells.
| |
| getBorderStyle | back to summary |
|---|---|
| public BorderStyle getBorderStyle(CellAddress cell, String property) Retrieves the border style for a given cell | |
| getBorderStyle | back to summary |
|---|---|
| public BorderStyle getBorderStyle(int row, int col, String property) Retrieves the border style for a given cell | |
| getNumBorderColors | back to summary |
|---|---|
| public int getNumBorderColors(CellAddress cell) Retrieves the number of border colors assigned to a cell | |
| getNumBorderColors | back to summary |
|---|---|
| public int getNumBorderColors(int row, int col) Retrieves the number of border colors assigned to a cell | |
| getNumBorders | back to summary |
|---|---|
| public int getNumBorders(CellAddress cell) Retrieves the number of borders assigned to a cell | |
| getNumBorders | back to summary |
|---|---|
| public int getNumBorders(int row, int col) Retrieves the number of borders assigned to a cell | |
| getShort | back to summary |
|---|---|
| private static short getShort(Object value) Converts a Short object to a short value or 0 if the object is not a Short
| |
| getTemplate | back to summary |
|---|---|
| private Map | |
| getTemplateProperty | back to summary |
|---|---|
| public short getTemplateProperty(CellAddress cell, String property) Retrieves the border style for a given cell | |
| getTemplateProperty | back to summary |
|---|---|
| public short getTemplateProperty(int row, int col, String property) Retrieves the border style for a given cell | |
| removeBorderColors | back to summary |
|---|---|
| private void removeBorderColors(CellRangeAddress range) Removes all border properties from this PropertyTemplate for the specified range.
| |
| removeBorders | back to summary |
|---|---|
| private void removeBorders(CellRangeAddress range) Removes all border properties from this PropertyTemplate for the specified range.
| |
| removeProperties | back to summary |
|---|---|
| private void removeProperties(int row, int col, Set<String> properties) Removes a set of properties from this PropertyTemplate for a given cell | |