public class CellStyle extends Object
| Constructor and Description |
|---|
CellStyle()
Creates cell style object with default parameters.
|
CellStyle(Cell cell)
Creates cell style object with style parameters of given cell.
|
| Modifier and Type | Method and Description |
|---|---|
void |
apply()
Applies this style to the current cell.
|
void |
applyTo(Cell cell,
boolean updateAll)
Applies this style to given cell.
|
CellStyle |
background(Color color)
Sets background color of cell.
|
CellStyle |
bold(boolean isBold)
Sets whether cells font should be bold.
|
CellStyle |
borderColors(Color... colors)
Sets colors for all cell borders (top, right, bottom and left).
|
CellStyle |
borders(BorderStyle... styles)
Sets styles of all cell borders (top, right, bottom and left).
|
CellStyle |
color(Color color)
Sets color of cells font.
|
CellStyle |
font(FontFamily font)
Sets font of cells.
|
CellStyle |
fontSize(int fontSize)
Sets size of cells font in points.
|
CellStyle |
format(NumberFormats format)
Sets cells number format.
|
CellStyle |
format(String pattern)
Sets cells custom number format using pattern.
|
Color |
getBackground() |
Color[] |
getBorderColors() |
BorderStyle[] |
getBorders() |
com.google.api.services.sheets.v4.model.CellFormat |
getCellFormat() |
Color |
getColor() |
FontFamily |
getFont() |
Integer |
getFontSize() |
String |
getFormatPattern() |
NumberFormats |
getFormatType() |
HorizontalAlignment |
getHorizontalAlignment() |
Integer[] |
getPadding() |
Integer |
getRotation() |
VerticalAlignment |
getVerticalAlignment() |
WrapStrategy |
getWrapStrategy() |
CellStyle |
hAlign(HorizontalAlignment hAlign)
Sets horizontal alignment of text in the cell.
|
boolean |
isBold() |
boolean |
isItalic() |
boolean |
isStrikeout() |
boolean |
isUnderline() |
boolean |
isVertical() |
CellStyle |
italic(boolean isItalic)
Sets whether cells font should be italic.
|
CellStyle |
padding(int... padding)
Sets amounts of padding around the cell, in pixels.
|
CellStyle |
rotation(int rotation)
Sets degree of rotation for the text in the cell.
|
CellStyle |
strikeout(boolean isStrikeout)
Sets whether cells font should be strikeout.
|
CellStyle |
underline(boolean isUnderline)
Sets whether cell font should be underlined.
|
CellStyle |
vAlign(VerticalAlignment vAlign)
Sets vertical alignment of text in the cell.
|
CellStyle |
vertical(boolean isVertical)
Sets whether the text in the cell should be displayed vertically.
|
CellStyle |
wrapStrategy(WrapStrategy strategy)
Sets how text in the cell should wrap.
|
public CellStyle()
public CellStyle(Cell cell)
cell - object representing source cell.public CellStyle font(FontFamily font)
font - the FontFamily of font to apply.public FontFamily getFont()
public CellStyle fontSize(int fontSize)
fontSize - the size of font in points.public Integer getFontSize()
public CellStyle bold(boolean isBold)
isBold - true to set as bold and false otherwise.public boolean isBold()
public CellStyle italic(boolean isItalic)
isItalic - true to set as italic and false otherwise.public boolean isItalic()
public CellStyle strikeout(boolean isStrikeout)
isStrikeout - true to set as strikeout and false otherwise.public boolean isStrikeout()
public CellStyle underline(boolean isUnderline)
isUnderline - true to set as underlined and false otherwise.public boolean isUnderline()
public CellStyle color(Color color)
color - the color to set.public Color getColor()
public CellStyle format(NumberFormats format)
format - the data format to set.NumberFormatspublic NumberFormats getFormatType()
public CellStyle format(String pattern)
See the Date and Number Formats guide for more information about the supported patterns.
pattern - the string with necessary format to set.public String getFormatPattern()
public CellStyle background(Color color)
color - the color to set.public Color getBackground()
public CellStyle hAlign(HorizontalAlignment hAlign)
hAlign - the alignment to set.HorizontalAlignmentpublic HorizontalAlignment getHorizontalAlignment()
public CellStyle vAlign(VerticalAlignment vAlign)
vAlign - the alignment to set.VerticalAlignmentpublic VerticalAlignment getVerticalAlignment()
public CellStyle wrapStrategy(WrapStrategy strategy)
strategy - necessary WrapStrategy to set.public WrapStrategy getWrapStrategy()
public CellStyle rotation(int rotation)
rotation - degree of rotation to set.public Integer getRotation()
public CellStyle vertical(boolean isVertical)
isVertical - true to display text vertically and false otherwise.public boolean isVertical()
public CellStyle borders(BorderStyle... styles)
It accepts single value (one style for all borders of the cell) or 4 values where each value correspond to specific border in the following order:
(<top>, <right>, <bottom>, <left>)
styles - styles of borders to set.BorderStylepublic BorderStyle[] getBorders()
public CellStyle borderColors(Color... colors)
It accepts single value (one color for all borders of the cell) or 4 values where each value correspond to specific border in the following order:
(<top>, <right>, <bottom>, <left>)
colors - colors to set.public Color[] getBorderColors()
public CellStyle padding(int... padding)
It accepts single value (one amount for all sides of the cell) or 4 values where each value correspond to amount of padding for specific side in the following order:
(<top>, <right>, <bottom>, <left>)
padding - padding to set.public Integer[] getPadding()
public com.google.api.services.sheets.v4.model.CellFormat getCellFormat()
public void apply()
public void applyTo(Cell cell, boolean updateAll)
cell - object representing target cell.updateAll - true to force updating of all cell format fields. Otherwise only dirty fields
will be updated.Copyright © 2022. All rights reserved.