org.apache.poi.ss.util

## Class PropertyTemplate

- java.lang.Object
- - org.apache.poi.ss.util.PropertyTemplate

-     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 Summary

    Constructors
    Constructor and Description
    `PropertyTemplate()` Create a PropertyTemplate object
    `PropertyTemplate(PropertyTemplate template)` Create a PropertyTemplate object from another PropertyTemplate

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PropertyTemplate

          public PropertyTemplate()

      Create a PropertyTemplate object

    - #### PropertyTemplate

          public PropertyTemplate(PropertyTemplate template)

      Create a PropertyTemplate object from another PropertyTemplate
      Parameters:
        `template` - a PropertyTemplate object

  - ### Method Detail

    - #### drawBorders

          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 `applyBorders(org.apache.poi.ss.usermodel.Sheet)`.
      Parameters:
        `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.

    - #### drawBorders

          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 `applyBorders(org.apache.poi.ss.usermodel.Sheet)`.
      Parameters:
        `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.

    - #### applyBorders

          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 `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.
      Parameters:
        `sheet` - - `Sheet` on which to apply borders

    - #### drawBorderColors

          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 `applyBorders(org.apache.poi.ss.usermodel.Sheet)`.
      Parameters:
        `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.

    - #### getNumBorders

          public int getNumBorders(CellAddress cell)

      Retrieves the number of borders assigned to a cell
      Parameters:
        `cell` -

    - #### getNumBorders

          public int getNumBorders(int row,
                                   int col)

      Retrieves the number of borders assigned to a cell
      Parameters:
        `row` -
        `col` -

    - #### getNumBorderColors

          public int getNumBorderColors(CellAddress cell)

      Retrieves the number of border colors assigned to a cell
      Parameters:
        `cell` -

    - #### getNumBorderColors

          public int getNumBorderColors(int row,
                                        int col)

      Retrieves the number of border colors assigned to a cell
      Parameters:
        `row` -
        `col` -

    - #### getBorderStyle

          public BorderStyle getBorderStyle(CellAddress cell,
                                            java.lang.String property)

      Retrieves the border style for a given cell
      Parameters:
        `cell` -
        `property` -

    - #### getBorderStyle

          public BorderStyle getBorderStyle(int row,
                                            int col,
                                            java.lang.String property)

      Retrieves the border style for a given cell
      Parameters:
        `row` -
        `col` -
        `property` -

    - #### getTemplateProperty

          public short getTemplateProperty(CellAddress cell,
                                           java.lang.String property)

      Retrieves the border style for a given cell
      Parameters:
        `cell` -
        `property` -

    - #### getTemplateProperty

          public short getTemplateProperty(int row,
                                           int col,
                                           java.lang.String property)

      Retrieves the border style for a given cell
      Parameters:
        `row` -
        `col` -
        `property` -

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.