public enum MultipleBorders extends Enum<MultipleBorders>
Diagonal-up (IndividualBorder.DIAGONAL_UP
/ DIAGONAL_UP
) and diagonal-down (IndividualBorder.DIAGONAL_DOWN
/ DIAGONAL_DOWN
)
always share the same color and line style.
Conceptually, cell formatting is divided into following groups:
CellStyle.getNumberFormat()
.
CellStyle.getHorizontalAlignment()
, CellStyle.getVerticalAlignment()
, CellStyle.getIndent()
, CellStyle.getRotation()
, CellStyle.isTextVertical()
, CellStyle.isWrapText()
and CellStyle.isShrinkToFit()
.
CellStyle.getFont()
.
CellStyle.getBorders()
.
CellStyle.getFillPattern()
.
CellStyle.isLocked()
and CellStyle.getFormulaHidden()
.
Additional CellStyle
fields not associated with any formatting group are:
CellStyle.getName()
- name of the referenced workbook style
.
CellStyle.getQuotePrefix()
- true
to store numeric value of a cell as text; otherwise, false
.
CellStyle.isDefault()
- true
if referenced
workbook style
is default (
CellStyleCollection.getNormal()
) and there are no additional modifications of cell formatting; otherwise, false
.
Workbook
contains a set of master styles
which can be referenced by multiple cells.
Workbook
must always contain at least one master style
which cannot be removed and is, by default, referenced by all cells. This default style is
CellStyleCollection.getNormal()
.
Workbook style
can either be built-in or user-defined. Built-in style is accessible from workbook styles
via BuiltInCellStyleName
enumeration.
Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated fields) is resolved from referenced
workbook (master) style
, unless cell formatting group or its associated field is modified.
Cell formatting is available for one or more cells through AbstractRange.getStyle()
field which is available on ExcelCell
and CellRange
types.
Cell formatting specified on ExcelColumn
and ExcelRow
types through ExcelColumnRowBase.getStyle()
field is simply propagated to cell formatting of its ExcelColumnRowBase.getCells()
.
For performance reasons, cell formatting on CellRange
is resolved based just on its top-left cell formatting, except borders which are resolved based on corner cells depending on border side.
Setting cell formatting field on CellRange
is propagated to each cell in a range.
To set workbook (master) style
to one or more cells, simply assign it to AbstractRange.getStyle()
field.
Preferable way to modify formatting field of multiple cells is to get CellRange
to which all those cells belong, and use AbstractRange.getStyle()
field of that range to make the modification.
If modifying multiple formatting fields of a CellRange
, without preserving unmodified formatting fields, preferable way is to create new instance of CellStyle
, make modifications on it, and assign it to AbstractRange.getStyle()
field of that range.
GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting all worksheet cells
) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.
CellBorders
,
IndividualBorder
Enum Constant and Description |
---|
BOTTOM
Bottom border.
|
DIAGONAL_DOWN
Diagonal-down border.
|
DIAGONAL_UP
Diagonal-up border.
|
INSIDE_HORIZONTAL
Inside horizontal borders.
|
INSIDE_VERTICAL
Inside vertical borders.
|
LEFT
Left border.
|
RIGHT
Right border.
|
TOP
Top border.
|
Modifier and Type | Method and Description |
---|---|
static EnumSet<MultipleBorders> |
all()
All borders except diagonal.
|
static EnumSet<MultipleBorders> |
diagonal()
Diagonal borders.
|
static EnumSet<MultipleBorders> |
horizontal()
Horizontal borders.
|
static EnumSet<MultipleBorders> |
inside()
Inside borders.
|
static EnumSet<MultipleBorders> |
outside()
Outside borders.
|
static MultipleBorders |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static MultipleBorders[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
static EnumSet<MultipleBorders> |
vertical()
Vertical borders.
|
public static final MultipleBorders BOTTOM
public static final MultipleBorders DIAGONAL_DOWN
public static final MultipleBorders DIAGONAL_UP
public static final MultipleBorders INSIDE_HORIZONTAL
public static final MultipleBorders INSIDE_VERTICAL
public static final MultipleBorders LEFT
public static final MultipleBorders RIGHT
public static final MultipleBorders TOP
public static EnumSet<MultipleBorders> all()
public static EnumSet<MultipleBorders> diagonal()
public static EnumSet<MultipleBorders> horizontal()
public static EnumSet<MultipleBorders> inside()
public static EnumSet<MultipleBorders> outside()
public static MultipleBorders valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static MultipleBorders[] values()
for (MultipleBorders c : MultipleBorders.values()) System.out.println(c);
public static EnumSet<MultipleBorders> vertical()
© GemBox Ltd. — All rights reserved.