-
-
Notifications
You must be signed in to change notification settings - Fork 36
Formatting options
The methods formatCell
, formatCellRange
, formatColumn
, formatColumns
, formatRow
and formatRows
all take a format
structure as an argument which can contain the keys and values below.
Note that if you are applying the same format to multiple cells it a good idea to first create the format as a cellStyle
object using createCellStyle() and then pass that as the format
argument (or the cellStyle
argument pre-version 3.8.0). See createCellStyle() for more details.
alignment
(string): One of the POI horizonal alignment values
bold
(boolean)
bottomborder
(string): One of the POI Border Styles
bottombordercolor
(string): See color
for possible values
color
(string): Can be any of the following:
- The name of a pre-set colour - full list of available colours, also viewable via the
getPresetColorNames()
method - an RGB triplet, e.g.
255,255,255
. NB: Only XLSX files can use exact RGB specified colours. Binary XLS files will use the closest pre-defined colour. - a hex value, e.g. "4B0082" or "#4B0082", which will be converted to an RGB triplet
dataformat
(string): One of the POI built-in formats, or your own custom formatting mask.
fgcolor
(string): See color
for possible values.
fillpattern
(string): One of the POI fill patterns
font
(string): name of a valid system font.
fontsize
(integer): size in points.
hidden
(boolean): (This doesn't appear to work).
indent
(integer): the number of spaces to indent the text in the cell. For XLS files, the maximum value is 15. (NB: this format may only work in MS Excel.)
italic
(boolean)
leftborder
(string): One of the POI Border Styles
leftbordercolor
(string): See color
for possible values
locked
(boolean): (This doesn't appear to work).
quoteprefixed
(boolean): Use to force a value to be added as a string (same effect as prefixing the value with a quote character)
rightborder
(string): One of the POI Border Styles
rightbordercolor
(string): See color
for possible values
rotation
(integer): -90
to 90
for XLS files, or 0
to 180
for XLSX
strikeout
(boolean)
topborder
(string): One of the POI Border Styles
topbordercolor
(string): See color
for possible values
textwrap
(boolean): whether the text should be wrapped
underline
(boolean OR string): Either true/false or one of the following: "none", "single", "double", "single accounting", "double accounting". The "accounting" types simply add a bit more space between the text and the underline in MS Excel.
verticalalignment
(string): One of the POI vertical alignment values