public class FormatHandle extends Object implements Handle, FormatConstants
The mutator methods of a FormatHandle object directly and immediately change
the formatting of the cell(s) to which it is applied. Under no circumstances
will a FormatHandle alter the formatting of cells to which it is not applied.
The list of cells to which a FormatHandle applies may be queried with the
#getCells method. Additional cells may be added with addCell(io.starter.OpenXLS.CellHandle)
and related methods.
A FormatHandle may also be obtained for a row or a column. In such a case the FormatHandle sets the default formats for the row or column. The default format for a row or column is the format which appears when no other formats for the cell are specified, such as for newly created cells.
| Modifier and Type | Field and Description |
|---|---|
static short |
colorBACKGROUND |
static short |
colorBORDER |
static short |
colorFONT |
static short |
colorFOREGROUND |
static Map<String,String> |
currencyFormatMap |
static Map<String,String> |
dateFormatMap |
static Map<String,String> |
numericFormatMap |
ALIGN_CENTER, ALIGN_CENTER_ACROSS_SELECTION, ALIGN_DEFAULT, ALIGN_FILL, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_VERTICAL_BOTTOM, ALIGN_VERTICAL_CENTER, ALIGN_VERTICAL_JUSTIFY, ALIGN_VERTICAL_TOP, Aqua, Black, Blue, BlueGray, BOLD, BORDER_DASH_DOT, BORDER_DASH_DOT_DOT, BORDER_DASHED, BORDER_DOTTED, BORDER_DOUBLE, BORDER_HAIR, BORDER_MEDIUM, BORDER_MEDIUM_DASH_DOT, BORDER_MEDIUM_DASH_DOT_DOT, BORDER_MEDIUM_DASHED, BORDER_NAMES, BORDER_NAMES_HTML, BORDER_NONE, BORDER_SIZES_HTML, BORDER_SLANTED_DASH_DOT, BORDER_STYLES_JSON, BORDER_THICK, BORDER_THIN, BrightGreen, Brown, BUILTIN_FORMATS, BUILTIN_FORMATS_JP, BUILTIN_FORMATS_MHTML, COLOR_AQUA, COLOR_BLACK, COLOR_BLACK2, COLOR_BLACK3, COLOR_BLUE, COLOR_BLUE_CHART, COLOR_BLUE_GRAY, COLOR_BRIGHT_GREEN, COLOR_BROWN, COLOR_CYAN, COLOR_DARK_BLUE, COLOR_DARK_GREEN, COLOR_DARK_PURPLE, COLOR_DARK_RED, COLOR_DARK_TEAL, COLOR_DARK_YELLOW, COLOR_GOLD, COLOR_GRAY25, COLOR_GRAY40, COLOR_GRAY50, COLOR_GRAY80, COLOR_GREEN, COLOR_INDIGO, COLOR_LAVENDER, COLOR_LIGHT_BLUE, COLOR_LIGHT_GREEN, COLOR_LIGHT_ORANGE, COLOR_LIGHT_PURPLE, COLOR_LIGHT_TURQUOISE, COLOR_LIGHT_YELLOW, COLOR_LIME, COLOR_MEDIUM_PURPLE, COLOR_OLIVE_GREEN, COLOR_OLIVE_GREEN_CHART, COLOR_ORANGE, COLOR_PALE_BLUE, COLOR_PINK, COLOR_PLUM, COLOR_RED, COLOR_RED_CHART, COLOR_ROSE, COLOR_SALMON, COLOR_SEA_GREEN, COLOR_SKY_BLUE, COLOR_TAN, COLOR_TEAL, COLOR_TURQUOISE, COLOR_VIOLET, COLOR_WHITE, COLOR_WHITE2, COLOR_WHITE3, COLOR_YELLOW, COLOR_YELLOW_CHART, COLORNAMES, COLORTABLE, CURRENCY_FORMATS, Dark_Blue, Dark_Green, Dark_Purple, Dark_Red, Dark_Teal, Dark_Yellow, DATE_FORMATS, DEFAULT_FONT_FACE, DEFAULT_FONT_SIZE, DEFAULT_FONT_WEIGHT, EXCEL_FORMAT_LOOKUP, FORMAT_NOSCRIPT, FORMAT_SUBSCRIPT, FORMAT_SUPERSCRIPT, Gold, Gray15, Gray25, Gray40, Gray50, Gray80, Green, HORIZONTAL_ALIGNMENTS, HTMLCOLORNAMES, Indigo, Lavender, Light_Blue, Light_Green, Light_Orange, Light_Purple, Light_Turquoise, Light_Yellow, Lime, Medium_Purple, NUMERIC_FORMATS, OliveGreen, Orange, PaleBlue, PATTERN_CHECKERBOARD1, PATTERN_CHECKERBOARD2, PATTERN_CROSSPATCH1, PATTERN_DIAG_STRIPES1, PATTERN_DIAG_STRIPES2, PATTERN_DIAG_STRIPES3, PATTERN_DIAG_STRIPES4, PATTERN_DIAG_STRIPES5, PATTERN_DIAG_STRIPES6, PATTERN_DIAG_STRIPES7, PATTERN_DIAG_STRIPES8, PATTERN_FILLED, PATTERN_GRID1, PATTERN_HOR_STRIPES1, PATTERN_HOR_STRIPES2, PATTERN_HOR_STRIPES3, PATTERN_HOR_STRIPES4, PATTERN_HVY_DOTS, PATTERN_HVY_FILL, PATTERN_LIGHT_DOTS, PATTERN_LIGHT_FILL, PATTERN_MED_DOTS, PATTERN_MED_FILL, PATTERN_NONE, PATTERN_PATCHY1, PATTERN_PATCHY2, PATTERN_PATCHY3, PATTERN_PATCHY4, PATTERN_VERT_STRIPES1, PATTERN_VERT_STRIPES2, PATTERN_VERT_STRIPES3, PATTERN_VERT_STRIPES4, patternmap, Pink, PLAIN, Plum, Red, Rose, Salmon, SeaGreen, SkyBlue, STYLE_UNDERLINE_DOUBLE, STYLE_UNDERLINE_DOUBLE_ACCTG, STYLE_UNDERLINE_NONE, STYLE_UNDERLINE_SINGLE, STYLE_UNDERLINE_SINGLE_ACCTG, SVGCOLORSTRINGS, Tan, Teal, Turquoise, VERTICAL_ALIGNMENTS, Violet, White, Yellow| Modifier | Constructor and Description |
|---|---|
|
FormatHandle()
Nullary constructor for use in bean context.
|
|
FormatHandle(CellHandle c)
Creates a FormatHandle for the given cell.
|
protected |
FormatHandle(Condfmt cx,
WorkBook book,
int xfnum,
CellHandle c)
Constructs a dummy FormatHandle for the given conditional format.
|
|
FormatHandle(WorkBook book)
Constructs a FormatHandle for the given WorkBook's default format.
|
|
FormatHandle(WorkBook book,
int xfnum)
Constructs a FormatHandle for the given format ID and WorkBook.
|
|
FormatHandle(WorkBook workBook,
int i)
Jan 27, 2011
|
protected |
FormatHandle(WorkBook book,
int xfnum,
boolean dedupe)
Constructs a FormatHandle for the given format index and WorkBook.
|
|
FormatHandle(WorkBook book,
String fontname,
int fontstyle,
int fontsize) |
|
FormatHandle(WorkBook book,
Xf xfr)
Constructs a FormatHandle for the given WorkBook and format record.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCell(CellHandle c)
add a Cell to this FormatHandle thus applying the Format to the Cell
|
void |
addCellArray(CellHandle[] crcells)
Apply this Format to a Range of Cells
|
void |
addCellRange(CellRange cr)
Apply this Format to a Range of Cells
|
void |
addCells(List<?> cx)
Add a List of Cells to this FormatHandle
|
static int |
addFont(Font f,
WorkBookHandle bk)
adds a font to the global font store only if exact font is not already
present
|
int |
addXf(Xf sourceXf)
adds all formatting represented by the sourceXf to this workbook, if not
already present
This is used internally for transferring formats from one workbook to another |
void |
adjustPrecision(boolean increase)
increase or decrease the precision of this numeric or curerncy format pattern
If the format pattern is "General", converts to a basic number pattern If the precision is already 0 and !increase, this method does nothing |
static int |
BorderStringToInt(String s) |
Object |
clone()
Create a copy of this FormatHandle with its own Xf
|
static Xf |
cloneXf(Xf xf,
Font f,
WorkBook wkbook)
static version of cloneXf
|
static Xf |
cloneXf(Xf xf,
WorkBook wkbook)
static version of cloneXf
|
void |
close()
clear out object references
|
static String |
colorToHexString(Color c)
Convert a java.awt.Color to a hex string.
|
static String |
convertFormatString(String pattern)
converts an Excel-style format string to a Java Format string.
|
boolean |
equals(Object another)
overrides the equals method to perform equality based on format
properties ------------------------------------------------------------
|
protected void |
finalize() |
int[] |
getAllBorderColors()
return the 5 border line colors (l, r, t, b, diag)
|
int[] |
getAllBorderLineStyles()
return the 5 border lines styles (l, r, t, b, diag)
|
int |
getBackgroundColor()
Get the Pattern Background Color for this Format Pattern
|
Color |
getBackgroundColorAsColor()
get the Pattern Background Color for this Format Pattern as an awt.Color
|
String |
getBackgroundColorAsHex()
get the Pattern Background Color for this Format Pattern as a hex string
|
boolean |
getBold()
Get if the font is bold
|
Color |
getBorderBottomColor()
Get the Right border color
|
Color[] |
getBorderColors()
returns Border Colors of Cell ie: top, left, bottom, right
returns null or 1 color for each of 4 sides
1,1,1,1 represents a border all around the cell 1,1,0,0 represents on the
top left edge of the cell
|
Color |
getBorderLeftColor()
Get the Left border color
|
Color |
getBorderRightColor()
Get the Right border color
|
Color |
getBorderTopColor()
Get the Top border color
|
int |
getBottomBorderLineStyle()
Get the border line style
|
int |
getCellBackgroundColor()
get the Pattern Background Color for this Formatted Cell
This method handles display of conditional formats for the cell
checks for conditional format, then applies it if conditions are true.
|
Color |
getCellBackgroundColorAsColor()
get the Pattern Background Color for this Format as an awt.Color
|
String |
getCellBackgroundColorAsHex()
get the Pattern Background Color for this Format as a Hex Color String
|
int |
getCellRotation()
Get the rotation of the cell.
|
static Color |
getColor(int col)
returns the index of the Color within the Colortable
|
static int |
getColorInt(Color col)
returns the index of the Color within the Colortable
|
int |
getFillPattern()
get the fill pattern for this format
|
Font |
getFont()
returns the existing font record for this Format
Font is an internal record and should not be accessed by end users
|
Color |
getFontColor()
Get the Font foreground (text) color as a java.awt.Color
|
String |
getFontColorAsHex() |
int |
getFontHeight()
Returns the Font's height in 1/20th point increment
|
double |
getFontHeightInPoints()
Get the font height in points
|
String |
getFontName()
Returns the Font's name
|
int |
getFontWeight()
Get the font weight the weight of the font is in 1/20 point units
|
int |
getForegroundColor()
get the Background Color for this Format NOTE: Foreground color = the
CELL BACKGROUND color color for all patterns and Background color= the
PATTERN color for all patterns != Solid For PATTERN_SOLID, Foreground
color=CELL BACKGROUND color and Background Color=64 (white).
|
Color |
getForegroundColorAsColor()
get the Background Color for this Format as a Color NOTE:
Foreground color = the CELL BACKGROUND color color for all patterns and
Background color= the PATTERN color for all patterns != Solid For
PATTERN_SOLID, Foreground color=CELL BACKGROUND color and Background
Color=64 (white).
|
String |
getForegroundColorAsHex()
get the Background Color for this Format as a Hex Color String NOTE:
Foreground color = the CELL BACKGROUND color color for all patterns and
Background color= the PATTERN color for all patterns != Solid For
PATTERN_SOLID, Foreground color=CELL BACKGROUND color and Background
Color=64 (white).
|
int |
getFormatId()
The format ID allows setting of the format for a Cell without adding it
to the Format's Cell Collection.
|
String |
getFormatPattern()
Gets the number format pattern for this format, if set.
|
int |
getFormatPatternId()
Gets the Excel format ID for this format's number format pattern.
|
int |
getHorizontalAlignment()
Returns an int representing the current horizontal alignment in this
FormatHandle.
|
int |
getIndent()
return indent (1 = 3 spaces)
|
boolean |
getIsBold()
Get if this format is bold or not
|
boolean |
getItalic()
Get if the font is italic
|
String |
getJavaFormatString()
provides a mapping between Excel formats and Java formats
see: http://java.sun.com/docs/books/tutorial/i18n/format /decimalFormat.html |
String |
getJSON(int XFNum)
Get a JSON representation of the format
|
org.json.JSONObject |
getJSONObject(int XFNum)
Get a JSON representation of the format
font height is represented as HTML pt size
|
int |
getLeftBorderLineStyle()
Get the border line style
|
int |
getRightBorderLineStyle()
Get the border line style
|
int |
getRightToLetReadingOrder()
returns true if this style is set to Right-to-Left text direction
(reading order)
|
boolean |
getStricken()
Determine if the format handle refers to a font stricken out
|
int |
getTopBorderLineStyle()
Get the border line style
|
int |
getTrueForegroundColor()
returns the foreground color setting regardless of format pattern (which
can switch fg and bg)
|
boolean |
getUnderlined()
Get if the font is underlined
|
int |
getUnderlineStyle()
Return an int representing the underline style
These map to the STYLE_UNDERLINE static integers *
|
int |
getVerticalAlignment()
Returns an int representing the current Vertical alignment in this
FormatHandle.
|
WorkBook |
getWorkBook() |
boolean |
getWrapText()
Get the cell wrapping behavior for this FormatHandle.
|
protected Xf |
getXf()
For internal usage only, return the internal XF record that
represents this FormatHandle
|
String |
getXML(int XFNum)
Returns an XML fragment representing the FormatHandle
|
String |
getXML(int XFNum,
boolean convertToUnicodeFont)
Returns an XML fragment representing the FormatHandle
|
static Color |
HexStringToColor(String s)
convert hex string RGB to a Color
|
static int |
HexStringToColorInt(String s,
short colorType)
convert hex string RGB to Excel colortable int format if an exact match
is not find, does color-matching to try and obtain closest match
|
static int |
HexStringToColorIntExact(String s,
short colorType)
convert hex string RGB to Excel colortable int format if no exact match
is found returns -1
|
static short |
interpretSpecialColorIndex(int clr)
interpret color table special entries
|
boolean |
isCurrency()
returns whether this Format is formatted as a Currency
|
boolean |
isDate()
returns whether this Format is formatted as a Date
|
boolean |
isFormulaHidden()
returns whether this FormatHandle is set to hide formula strings
|
boolean |
isLocked()
returns whether this Format Handle specifies that cells are locked for
changing
|
boolean |
isRedWhenNegative()
Returns true if the value should be red due to a combination of a format
pattern and a negative number
|
boolean |
isStyleXf()
return truth of "this Xf rec is a style xf"
|
FormatHandle |
pack()
Deprecated.
|
void |
removeBorders()
remove borders for this format
|
void |
setBackgroundColor(Color colr)
set the Background Color for this Format NOTE: Foreground color = the
CELL BACKGROUND color color for all patterns and Background color= the
PATTERN color for all patterns != Solid For PATTERN_SOLID, Foreground
color=CELL BACKGROUND color and Background Color=64 (white).
|
void |
setBackgroundColor(int t)
set the background color for this Format NOTE: Foreground color = the
CELL BACKGROUND color color for all patterns and Background color= the
PATTERN color for all patterns != Solid For PATTERN_SOLID, Foreground
color=CELL BACKGROUND color and Background Color=64 (white).
|
void |
setBackgroundPattern(int t)
set the Background Pattern for this Format
|
void |
setBold(boolean isBold)
Set the format handle to use standard bold text
|
void |
setBorderBottomColor(Color x)
Set the top border color
|
void |
setBorderBottomColor(int x)
Set the top border color
|
void |
setBorderColor(Color col)
set the border color for all borders (top, left, bottom, and right) to
one java.awt.Color
|
void |
setBorderColor(int x)
set the border color for all borders (top, left, bottom, and right) to
one color via color constant
|
void |
setBorderColors(Color[] bordercolors)
sets the border color for all borders (top, left, bottom and right) from
a Color array
|
void |
setBorderColors(int[] bordercolors)
sets the border color for all borders (top, left, bottom and right) from
an int array containing color constants
|
void |
setBorderDiagonal(int x)
Set the border line style
|
void |
setBorderLeftColor(Color x)
Set the top border color
|
void |
setBorderLeftColor(int x)
Set the top border color
|
void |
setBorderLineStyle(int x)
Sets the border line style using static BORDER_ shorts within
FormatHandle
|
void |
setBorderLineStyle(int[] b)
set border line styles via array of ints representing border styles
order= left, right, top, bottom, [diagonal]
|
void |
setBorderLineStyle(short x)
Set the border line style
|
void |
setBorderRightColor(Color x)
Set the top border color
|
void |
setBorderRightColor(int x)
Set the top border color
|
void |
setBorderTopColor(Color x)
Set the top border color
|
void |
setBorderTopColor(int x)
Set the top border color
|
void |
setBottomBorderLineStyle(int x)
Set the border line style
|
void |
setCellBackgroundColor(Color colr)
set the Cell Background Color for this Format
NOTE: Foreground color = the CELL BACKGROUND color color for all patterns
and Background color= the PATTERN color for all patterns != Solid For
PATTERN_SOLID, Foreground color=CELL BACKGROUND color and Background
Color=64 (white).
|
void |
setCellBackgroundColor(int t)
makes the cell a solid pattern background if no pattern was already
present NOTE: Foreground color = the CELL BACKGROUND color color for all
patterns and Background color= the PATTERN color for all patterns !=
Solid For PATTERN_SOLID, Foreground color=CELL BACKGROUND color and
Background Color=64 (white).
|
void |
setCellRotation(int align)
Set the rotation of the cell in degrees.
|
void |
setColHandle(ColHandle c)
Set a column handle on this format handle, so all changes applied to this
format will be applied to the entire column
|
protected void |
setFill(Fill f)
sets this fill pattern from an existing OOXML (2007v) fill element
|
void |
setFill(int fillpattern,
int fg,
int bg)
sets the fill for this format handle if fill==Xf.PATTERN_SOLID then fg is
the PATTERN color i.e the CELL BG COLOR
|
void |
setFont(Font f)
Set the Font for this Format.
|
void |
setFont(String fn,
int stl,
double sz)
Sets this format handle to a font
|
void |
setFontColor(Color colr)
set the Font Color for this Format
|
void |
setFontColor(int t)
set the Font Color for this Format via indexed color constant
|
void |
setFontColor(String clr)
sets the Font color for this Format via web Hex String
|
void |
setFontHeight(int fontHeight)
Set the Font's height in 1/20th point increment
|
void |
setFontName(String fontName)
Set the Font's name
To be valid, this font name must be available on the client system.
|
void |
setFontWeight(int wt)
/** Set the weight of the font in 1/20 point units 100-1000 range.
|
void |
setForegroundColor(Color colr)
set the foreground Color for this Format NOTE: Foreground color = the
CELL BACKGROUND color color for all patterns and Background color= the
PATTERN color for all patterns != Solid For PATTERN_SOLID, Foreground
color=CELL BACKGROUND color and Background Color=64 (white).
|
void |
setForegroundColor(int t)
set the Foreground Color for this Format NOTE: Foreground color = the
CELL BACKGROUND color color for all patterns and Background color= the
PATTERN color for all patterns != Solid For PATTERN_SOLID, Foreground
color=CELL BACKGROUND color and Background Color=64 (white).
|
void |
setFormatId(int x)
set the pointer to the XFE or Conditional format
|
void |
setFormatPattern(String pat)
Sets the number format pattern for this format.
|
void |
setFormatPatternId(int fmt)
Sets the number format pattern based on the format ID number.
|
void |
setFormulaHidden(boolean b)
sets the cell attached to this FormatHandle to hide or show formula
strings;
|
void |
setHorizontalAlignment(int align)
Set the horizontal alignment for this FormatHandle
|
void |
setIndent(int indent)
set indent (1= 3 spaces)
|
void |
setItalic(boolean isItalic)
Set if the font is italic
|
void |
setLeftBorderLineStyle(int x)
Set the border line style
|
void |
setLocked(boolean locked)
Locks the cell attached to this FormatHandle for editing (makes
read-only) lock cell and make read-only
|
void |
setPattern(int pat) |
void |
setRightBorderLineStyle(int x)
Set the border line style
|
void |
setRightToLeftReadingOrder(int rtl)
sets the Right to Left Text Direction or reading order of this style
|
void |
setRowHandle(RowHandle c)
Set a row handle on this format handle, so all changes applied to this
format will be applied to the entire row
|
void |
setScript(int ss)
super/sub (0 = none, 1 = super, 2 = sub)
|
void |
setStricken(boolean isStricken)
Set if the format handle is stricken out
|
void |
setTopBorderLineStyle(int x)
Set the border line style
|
void |
setUnderlined(boolean isUnderlined)
Set underline attribute on the font
|
void |
setUnderlineStyle(int u)
set the underline style for this font
|
void |
setVerticalAlignment(int align)
Set the Vertical alignment for this FormatHandle
|
void |
setWorkBook(WorkBook bk)
Set the workbook for this FormatHandle
|
void |
setWrapText(boolean wrapit)
Set the cell wrapping behavior for this FormatHandle.
|
void |
setXf(Xf xrec)
Sets the internal format to the FormatHandle.
|
void |
stamp(CellHandle cell)
Applies the format to a cell without establishing a relationship.
|
void |
stamp(CellRange range)
Applies the format to a cell range without establishing a relationship.
|
String |
toString() |
protected void |
updateFromCF(Cf cf,
WorkBook book)
updates this format handle via a Cf rule
|
public static short colorFONT
public static short colorBACKGROUND
public static short colorFOREGROUND
public static short colorBORDER
public FormatHandle()
public FormatHandle(WorkBook book, Xf xfr)
public FormatHandle(WorkBook book)
public FormatHandle(WorkBook book, int xfnum)
CellHandle cell = <get cell here>;
FormatHandle format = new FormatHandle(
cell.getWorkBook(), cell.getFormatId() );
book - the WorkBook from which the format should be retrievedxfnum - the ID of the formatprotected FormatHandle(WorkBook book, int xfnum, boolean dedupe)
protected FormatHandle(Condfmt cx, WorkBook book, int xfnum, CellHandle c)
This unique flavor of FormatHandle is only used to display the formatting values of a Conditional format record. Creates a dummy Xf to store values, otherwise has no effect on the WorkBook record stream which are manipulated through CellHandle.
book - containing the conditional formatsthe - index to the conditional format in the book collectionpublic FormatHandle(CellHandle c)
CellHandle.getFormatHandle() instead.public FormatHandle(WorkBook workBook, int i)
workBook - i - protected void updateFromCF(Cf cf, WorkBook book)
cf - Cf rulebook - workbookpublic boolean equals(Object another)
public void setLocked(boolean locked)
boolean - locked - true if cells should be locked for this
FormatHandlepublic void setFormulaHidden(boolean b)
boolean - b- true if formulas should be hidden for this FormatHandlepublic boolean isFormulaHidden()
public boolean isLocked()
public String getJavaFormatString()
Note there are slight Excel-specific differences in the format strings returned. Several numeric and currency formats in excel have different formatting for postive and negative numbers. In these cases, the java format string is split by semicolons and may contain text [Red] which is to specify the negative number should be displayed in red. Remove this from the string before passing into the Format class;
G Era designator Text AD
y Year Year 1996; 96
M Month in year Month July; Jul; 07
w Week in year Number 27
W Week in month Number 2
D Day in year Number 189
d Day in month Number 10
F Day of week in month Number 2
E Day in week Text Tuesday; Tue
a Am/pm marker Text PM
H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24
K Hour in am/pm (0-11) Number 0
h Hour in am/pm (1-12) Number 12
m Minute in hour Number 30
s Second in minute Number 55
S Millisecond Number 978
z Time zone General time zone Pacific Standard Time; PST; GMT-08:00
Z Time zone RFC 822 time zone -0800
public static String convertFormatString(String pattern)
String - pattern - Excel Format StringgetJavaFormatStringpublic void setBorderColors(Color[] bordercolors)
NOTE: this setting will affect every cell which refers to this FormatHandle
java - .awt.Color array - 4-element array of desired border colors
[T, L, B, R]public void removeBorders()
public void setBorderColors(int[] bordercolors)
NOTE: this setting will affect every cell which refers to this FormatHandle
int[] - bordercolors - 4-element array of desired border color
constants [T, L, B, R]constantspublic void setBorderColor(int x)
NOTE: this setting will affect every cell which refers to this FormatHandle
int - x - color constant which represents the color to set all
border sidesconstantspublic void setBorderColor(Color col)
NOTE: this setting will affect every cell which refers to this FormatHandle
Color - col - color to set all border sidespublic void setBorderRightColor(int x)
color - constantpublic void setBorderRightColor(Color x)
color - constantpublic Color getBorderRightColor()
public void setBorderLeftColor(int x)
color - constantpublic void setBorderLeftColor(Color x)
color - constantpublic Color[] getBorderColors()
public Color getBorderLeftColor()
public void setBorderTopColor(int x)
color - constantpublic Color getBorderTopColor()
public void setBorderTopColor(Color x)
color - constantpublic void setBorderBottomColor(int x)
color - constantpublic void setBorderBottomColor(Color x)
color - constantpublic boolean isRedWhenNegative()
public Color getBorderBottomColor()
public void setTopBorderLineStyle(int x)
line - style constantpublic int getTopBorderLineStyle()
public void setBottomBorderLineStyle(int x)
line - style constantpublic int getBottomBorderLineStyle()
public void setLeftBorderLineStyle(int x)
line - style constantpublic int getLeftBorderLineStyle()
public void setRightBorderLineStyle(int x)
line - style constantpublic int getRightBorderLineStyle()
public void setBorderLineStyle(int x)
line - style constantpublic void setBorderLineStyle(int[] b)
b - int[]public void setBorderLineStyle(short x)
line - style constantpublic int[] getAllBorderLineStyles()
public int[] getAllBorderColors()
public void setBorderDiagonal(int x)
line - style constantpublic void setColHandle(ColHandle c)
c - public void setRowHandle(RowHandle c)
c - public Object clone()
public void setFontWeight(int wt)
wt - public int getFontWeight()
public void setFont(Font f)
String - font nameint - font styleint - font sizepublic void setFont(String fn, int stl, double sz)
fn - font name e.g. 'Arial'stl - font style either Font.PLAIN or Font.BOLDsz - font size or height in 1/20 point unitspublic static int addFont(Font f, WorkBookHandle bk)
f - Fontbk - WorkBookHandlepublic void addCellRange(CellRange cr)
CellRange - to apply the format topublic void addCellArray(CellHandle[] crcells)
CellHandle - array to apply the format topublic void addCell(CellHandle c)
CellHandle - to apply the format topublic void addCells(List<?> cx)
cx - public void stamp(CellHandle cell)
FormatHandle will be applied to
the cell but it will not be updated with any future changes. If you want
that behavior use addCell instead.public void stamp(CellRange range)
FormatHandle will be applied
to the cells but they will not be updated with any future changes. If you
want that behavior use addCell instead.public void setBackgroundPattern(int t)
int - Excel color constantpublic boolean isDate()
public boolean isCurrency()
public void setUnderlineStyle(int u)
int - u underline style one of the Font.STYLE_UNDERLINE constantspublic void setScript(int ss)
int - script type for Format Fontpublic void setFontColor(int t)
int - Excel color constantpublic void setFontColor(Color colr)
AWT - Color color constantpublic void setFontColor(String clr)
clr - public Color getFontColor()
public String getFontColorAsHex()
public void setForegroundColor(int t)
int - Excel color constantpublic void setForegroundColor(Color colr)
AWT - Color constantpublic void setBackgroundColor(int t)
t - Excel color constantpublic void setCellBackgroundColor(Color colr)
awt - Color color constantpublic void setCellBackgroundColor(int t)
int - Excel color constantprotected void setFill(Fill f)
f - public void setFill(int fillpattern,
int fg,
int bg)
fillpattern - fg - bg - public int getBackgroundColor()
public String getBackgroundColorAsHex()
public Color getBackgroundColorAsColor()
public int getTrueForegroundColor()
public int getCellBackgroundColor()
public String getCellBackgroundColorAsHex()
public Color getCellBackgroundColorAsColor()
public int getForegroundColor()
public String getForegroundColorAsHex()
public Color getForegroundColorAsColor()
public void setBackgroundColor(Color colr)
awt - Color color constantpublic void setBold(boolean isBold)
boolean - isBoldpublic boolean getIsBold()
public int getUnderlineStyle()
public double getFontHeightInPoints()
public int getFontHeight()
public void setFontHeight(int fontHeight)
new - font heightpublic String getFontName()
public void setFontName(String fontName)
font - namepublic boolean getStricken()
public void setStricken(boolean isStricken)
isStricken - boolean representing if the formatted cell should be stricken
out.public boolean getItalic()
public void setItalic(boolean isItalic)
isItalic - boolean representing if the formatted cell should be italic.public boolean getUnderlined()
public void setUnderlined(boolean isUnderlined)
isUnderlined - boolean representing if the formatted cell should be
underlinedpublic boolean getBold()
public Font getFont()
public void setFormatPattern(String pat)
CellHandle.getFormattedStringVal()) but they will be written
correctly to the output file. For more information on number format
patterns see Microsoft
KB264372.pat - the Excel number format pattern to applyFormatConstantsImpl.getBuiltinFormats()public void setPattern(int pat)
public int getFormatId()
public String getFormatPattern()
null if none is appliedpublic int getFillPattern()
public static Color getColor(int col)
the - index of the color in the colortablepublic static int getColorInt(Color col)
col - the colorpublic void setXf(Xf xrec)
public void setHorizontalAlignment(int align)
align - - an int representing the alignment. Please review the
FormatHandle.ALIGN*** static int'spublic int getHorizontalAlignment()
public void setIndent(int indent)
indent - public void adjustPrecision(boolean increase)
increase - true if increase the precsion (number of decimals to display)public int getIndent()
public void setRightToLeftReadingOrder(int rtl)
rtl - possible values:
rtl - possible values: public int getRightToLetReadingOrder()
public void setVerticalAlignment(int align)
align - - an int representing the alignment. Please review the
FormatHandle.ALIGN*** static int'spublic int getVerticalAlignment()
public FormatHandle pack()
public void setWorkBook(WorkBook bk)
bk - public void setWrapText(boolean wrapit)
public boolean getWrapText()
public void setCellRotation(int align)
align - - an int representing the rotation.public int getCellRotation()
public String getJSON(int XFNum)
cr - public org.json.JSONObject getJSONObject(int XFNum)
cr - public String getXML(int XFNum)
public String getXML(int XFNum, boolean convertToUnicodeFont)
convertToUnicodeFont - if true, font family will be changed to ArialUnicodeMS
(standard unicode) for non-ascii fontspublic int getFormatPatternId()
public void setFormatPatternId(int fmt)
setFormatPattern(String) instead.fmt - the format ID number for the desired number format patternpublic static String colorToHexString(Color c)
public static int HexStringToColorInt(String s, short colorType)
s - colorType - public static int HexStringToColorIntExact(String s, short colorType)
s - HTML color string (#XXXXXX) format or (#FFXXXXXX - OOXML-style
format)colorType - public static Color HexStringToColor(String s)
s - web-style hex color string, including #, or OOXML-style color string, FFXXXXXXColorpublic static short interpretSpecialColorIndex(int clr)
clr - color index in range of 0x41-0x4F (charts) 0x40 ...public static int BorderStringToInt(String s)
public WorkBook getWorkBook()
public boolean isStyleXf()
public int addXf(Xf sourceXf)
xf - - sourceXfpublic static Xf cloneXf(Xf xf, WorkBook wkbook)
xf - wkbook - public static Xf cloneXf(Xf xf, Font f, WorkBook wkbook)
xf - wkbook - public void setFormatId(int x)
xfe - public void close()
protected void finalize()
throws Throwable
protected Xf getXf()
Copyright © 2002–2019 Starter Inc.. All rights reserved.