Class CellStyle
- java.lang.Object
- com.gembox.spreadsheet.CellStyle
public class CellStyle
Represents cell formatting.
Conceptually, cell formatting is divided into following groups:
- Number - indicates how to format and render the numeric value of a cell. Associated method is CellStyle#setNumberFormat.
- Alignment - formatting information pertaining to text alignment in cells. Associated methods are CellStyle#setHorizontalAlignment, CellStyle#setVerticalAlignment, CellStyle#setIndent, CellStyle#setRotation, CellStyle#setTextVertical, CellStyle#setWrapText and CellStyle#setShrinkToFit.
- Font - defines the methods for the used font. Associated method is CellStyle#setFont.
- Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated method is CellStyle#setBorders.
- Fill - specifies fill formatting (pattern or gradient). Associated method is CellStyle#setFillPattern.
- Protection - contains protection methods associated with the cell. Associated methods are CellStyle#setLocked and CellStyle#setFormulaHidden.
Additional CellStyle methods not associated with any formatting group are:
- CellStyle#getName - name of the referenced workbook style.
- CellStyle#setQuotePrefix -
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 methods) is resolved from referenced workbook (master) style, unless cell formatting group or its associated method is modified.
Cell formatting is available for one or more cells through AbstractRange#setStyle method which is available on ExcelCell and CellRange types. Cell formatting specified on ExcelColumn and ExcelRow types through ExcelColumnRowBase#setStyle method 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 method 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#setStyle method.
Preferable way to modify formatting method of multiple cells is to get CellRange to which all those cells belong, and use AbstractRange#setStyle method of that range to make the modification.
If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it using AbstractRange#setStyle method 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.
Following code demonstrates how to set workbook style to a range of cells:
// Set 'Good' style to all cells of the first sheet.
workbook.getWorksheet(0).getCells().setStyle(workbook.getStyle(BuiltInCellStyleName.GOOD));
Following code demonstrates when not to and when to initialize a new instance of the CellStyle class:
// To modify a single formatting property on a range of cells, simply modify it.
// Other formatting properties will remain unchanged.
sheet.getCells().getStyle().getFont().setItalic(true);
// To modify multiple formatting properties on a range of cells, create new CellStyle instance, modify it, and assign it to a range of cells.
// All formatting properties are changed.
CellStyle style = new CellStyle(sheet.getParent());
style.setNumberFormat("#,##0.00");
style.setHorizontalAlignment(HorizontalAlignmentStyle.CENTER);
style.setLocked(false);
sheet.getCells().setStyle(style);
Following code demonstrates cell formatting:
// 'Number' formatting group
sheet.getCell("B3").setValue("NumberFormat");
sheet.getCell("C3").setValue(1234);
sheet.getCell("C3").getStyle().setNumberFormat("#.##0,00 [$Krakozhian Money Units]");
// 'Alignment' formatting group
sheet.getCell("B5").setValue("HorizontalAlignment = ");
sheet.getCell("C5").setValue("HorizontalAlignmentStyle.Center");
sheet.getCell("C5").getStyle().setHorizontalAlignment(HorizontalAlignmentStyle.CENTER);
sheet.getCell("B6").setValue("VerticalAlignment = ");
sheet.getCell("C6").setValue("VerticalAlignmentStyle.Top");
sheet.getCell("C6").getStyle().setVerticalAlignment(VerticalAlignmentStyle.TOP);
// Set row height to 30 points.
sheet.getRow("6").setHeight(30 * 20);
sheet.getCell("B7").setValue("Indent");
sheet.getCell("C7").setValue("five");
sheet.getCell("C7").getStyle().setIndent(5);
sheet.getCell("C7").getStyle().setHorizontalAlignment(HorizontalAlignmentStyle.LEFT);
sheet.getCell("B8").setValue("Rotation");
sheet.getCell("C8").setValue("35 degrees up");
sheet.getCell("C8").getStyle().setRotation(35);
sheet.getCell("B9").setValue("IsTextVertical = ");
sheet.getCell("C9").setValue("true");
sheet.getCell("C9").getStyle().setTextVertical(true);
sheet.getCell("B10").setValue("WrapText");
sheet.getCell("C10").setValue("This property is set to true so this text appears broken into multiple lines.");
sheet.getCell("C10").getStyle().setWrapText(true);
sheet.getCell("B11").setValue("ShrinkToFit");
sheet.getCell("C11").setValue("This property is set to true so this text appears shrunk.");
sheet.getCell("C11").getStyle().setShrinkToFit(true);
// 'Font' formatting group
sheet.getCell("B13").setValue("Font.Name = ");
sheet.getCell("C13").setValue("Comic Sans MS");
sheet.getCell("C13").getStyle().getFont().setName("Comic Sans MS");
sheet.getCell("B14").setValue("Font.Italic = ");
sheet.getCell("C14").setValue("true");
sheet.getCell("C14").getStyle().getFont().setItalic(true);
sheet.getCell("B15").setValue("Font.Weight = ");
sheet.getCell("C15").setValue("ExcelFont.BoldWeight");
sheet.getCell("C15").getStyle().getFont().setWeight(ExcelFont.BOLD_WEIGHT);
sheet.getCell("B16").setValue("Font.Size = ");
sheet.getCell("C16").setValue("18 * 20");
sheet.getCell("C16").getStyle().getFont().setSize(18 * 20);
sheet.getCell("B17").setValue("Font.Color");
sheet.getCell("C17").setValue("Text2");
sheet.getCell("C17").getStyle().getFont().setColor(SpreadsheetColor.fromName(ColorName.TEXT_2));
sheet.getCell("B18").setValue("Font.UnderlineStyle = ");
sheet.getCell("C18").setValue("UnderlineStyle.Double");
sheet.getCell("C18").getStyle().getFont().setUnderlineStyle(UnderlineStyle.DOUBLE);
sheet.getCell("B19").setValue("Font.Strikeout = ");
sheet.getCell("C19").setValue("true");
sheet.getCell("C19").getStyle().getFont().setStrikeout(true);
sheet.getCell("B20").setValue("Font.ScriptPosition = ");
sheet.getCell("C20").setValue("ScriptPosition.Superscript");
sheet.getCell("C20").getStyle().getFont().setScriptPosition(ScriptPosition.SUBSCRIPT);
// 'Border' formatting group
sheet.getCell("B22").setValue("Borders.setBorders(...)");
sheet.getCell("C22").getStyle().getBorders().setBorders(MultipleBorders.all(), SpreadsheetColor.fromName(ColorName.ACCENT_2), LineStyle.THIN);
// 'Fill' formatting group
sheet.getCell("B24").setValue("FillPattern.setPattern(...)");
sheet.getCell("C24").getStyle().getFillPattern().setPattern(FillPatternStyle.THIN_HORIZONTAL_CROSSHATCH, SpreadsheetColor.fromName(ColorName.GREEN), SpreadsheetColor.fromName(ColorName.YELLOW));
sheet.getCell("B25").setValue("FillPattern.setGradient(...)");
sheet.getCell("C25").getStyle().getFillPattern().setGradient(GradientShadingStyle.HORIZONTAL_HIGH, SpreadsheetColor.fromName(ColorName.GREEN), SpreadsheetColor.fromName(ColorName.YELLOW));
// 'Protection' formatting group
sheet.getCell("B27").setValue("Locked = ");
sheet.getCell("C27").setValue("false");
sheet.getCell("C27").getStyle().setLocked(false);
sheet.getCell("B28").setValue("FormulaHidden = ");
sheet.getCell("C28").setValue("true");
sheet.getCell("C28").getStyle().setFormulaHidden(true);
Constructor Summary
Constructor and Description |
---|
CellStyle() Initializes a new instance of the CellStyle class not associated with any workbook. |
CellStyle(ExcelFile workbook) Initializes a new instance of the CellStyle class which references default (CellStyleCollection#getNormal) style from the specified workbook. |
Method Summary
Modifer and Type | Method and Description |
---|---|
CellBorders | getBorders() Gets the borders. |
ExcelFillPattern | getFillPattern() Gets the fill (cell background). |
ExcelFont | getFont() Gets the font. |
boolean | getFormulaHidden() Gets a value indicating whether the contents of the cell will not be displayed in the formula bar. |
HorizontalAlignmentStyle | getHorizontalAlignment() Gets the horizontal alignment. |
int | getIndent() Gets the number of spaces (of the CellStyleCollection#getNormal style font) of indentation for text in a cell. |
String | getName() If CellStyle is workbook Style, Gets the name of the style; otherwise, gets the name of the referenced workbook Style from which this CellStyle inherits formatting. |
String | getNumberFormat() Gets the number format which indicates how to format and render the numeric value of a cell. |
String | getNumberFormatLocal() Gets a |
boolean | getQuotePrefix() Gets a value indicating whether the text string in a cell should be prefixed by a single quote mark (e.g., 'text). Use it to store numeric value of a cell as text. |
int | getRotation() Gets the text rotation in degrees (1/360th of a full circle). |
VerticalAlignmentStyle | getVerticalAlignment() Gets the vertical alignment. |
boolean | isDefault() Gets a value indicating whether the referenced workbook style is default (CellStyleCollection#getNormal) and there are no additional modifications of cell formatting. |
boolean | isLocked() Gets a value indicating whether the cell is locked. |
boolean | isShrinkToFit() Gets a value indicating whether the displayed text in the cell should be shrunk to fit the cell width. Not applicable when a cell contains multiple lines of text. |
boolean | isTextVertical() Gets a value indicating whether text orientation is vertical. |
boolean | isWrapText() Gets a value indicating whether the text in a cell should be line-wrapped within the cell. |
void | setBorders(CellBorders borders) Sets the borders. |
void | setFillPattern(ExcelFillPattern fillPattern) Sets the fill (cell background). |
void | setFont(ExcelFont font) Sets the font. |
void | setFormulaHidden(boolean formulaHidden) Sets a value indicating whether the contents of the cell will not be displayed in the formula bar. |
void | setHorizontalAlignment(HorizontalAlignmentStyle horizontalAlignment) Sets the horizontal alignment. |
void | setIndent(int indent) Sets the number of spaces (of the CellStyleCollection#getNormal style font) of indentation for text in a cell. |
void | setLocked(boolean locked) Sets a value indicating whether the cell is locked. |
void | setNumberFormat(String numberFormat) Sets the number format which indicates how to format and render the numeric value of a cell. |
void | setQuotePrefix(boolean quotePrefix) Sets a value indicating whether the text string in a cell should be prefixed by a single quote mark (e.g., 'text). Use it to store numeric value of a cell as text. |
void | setRotation(int rotation) Sets the text rotation in degrees (1/360th of a full circle). |
void | setShrinkToFit(boolean shrinkToFit) Sets a value indicating whether the displayed text in the cell should be shrunk to fit the cell width. Not applicable when a cell contains multiple lines of text. |
void | setTextVertical(boolean textVertical) Sets the text rotation in degrees (1/360th of a full circle). |
void | setVerticalAlignment(VerticalAlignmentStyle verticalAlignment) Sets the vertical alignment. |
void | setWrapText(boolean wrapText) Sets a value indicating whether the text in a cell should be line-wrapped within the cell. |
String | toString() |
Constructor Detail
CellStyle
public CellStyle()
Initializes a new instance of the CellStyle class not associated with any workbook.
Preferable way to modify formatting of multiple cells is to get CellRange to which all those cells belong, and use AbstractRange#setStyle method of that range to make the modification.
If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to AbstractRange#setStyle method of that range.
CellStyle
public CellStyle(ExcelFile workbook)
Initializes a new instance of the CellStyle class which references default (CellStyleCollection#getNormal) style from the specified workbook.
Preferable way to modify formatting of multiple cells is to get CellRange to which all those cells belong, and use AbstractRange#setStyle method of that range to make the modification.
If modifying multiple formatting properties of a CellRange, without preserving unmodified formatting properties, preferable way is to create new instance of CellStyle, make modifications on it, and assign it to AbstractRange#setStyle method of that range.
- Parameters:
- workbook -
The workbook from which default (CellStyleCollection#getNormal) style this CellStyle inherits formatting.
Method Detail
getBorders
public final CellBorders getBorders()
Gets the borders.
If set to null
, borders will be resolved from referenced workbook style.
- Returns:
The borders.
getFillPattern
public final ExcelFillPattern getFillPattern()
Gets the fill (cell background).
- Returns:
The fill (cell background).
getFormulaHidden
public final boolean getFormulaHidden()
Gets a value indicating whether the contents of the cell will not be displayed in the formula bar.
Default value is false
.
When the cell is hidden and the workbook is protected or the sheet on which the cell resides is protected, then the cell value will be displayed in the cell grid location, but the contents of the cell will not be displayed in the formula bar. This is true for all types of cell content, including formula, text, or numbers.
- Returns:
true
if the contents of the cell will not be displayed in the formula bar; otherwise,false
.
getHorizontalAlignment
public final HorizontalAlignmentStyle getHorizontalAlignment()
Gets the horizontal alignment.
Default value is HorizontalAlignmentStyle#GENERAL.
- Returns:
The horizontal alignment.
getIndent
public final int getIndent()
Gets the number of spaces (of the CellStyleCollection#getNormal style font) of indentation for text in a cell.
The number of spaces to indent is calculated as following: Number of spaces to indent = CellStyle#getIndent * 3.
Default value is 0.
If #isTextVertical is true
, Horizontal alignment should be set to HorizontalAlignmentStyle#LEFT, HorizontalAlignmentStyle#RIGHT or HorizontalAlignmentStyle#DISTRIBUTED.
If #isTextVertical is false
, Vertical alignment should be set to VerticalAlignmentStyle#BOTTOM, VerticalAlignmentStyle#TOP or VerticalAlignmentStyle#DISTRIBUTED.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Returns:
The number of spaces (of the CellStyleCollection#getNormal style font) of indentation for text in a cell.
getNumberFormat
public final String getNumberFormat()
Gets the number format which indicates how to format and render the numeric value of a cell.
Default value is General.
If set to null
, number format will be resolved from referenced workbook style.
If the value of this property is General or empty string and ExcelCell value is of LocalDateTime type, ISO date/time format will be used as number format.
- Returns:
The number format which indicates how to format and render the numeric value of a cell.
getNumberFormatLocal
public final String getNumberFormatLocal()
Gets a String
that represents the format code for the numeric value in the language of the user.
- Returns:
A
String
that represents the format code for the numeric value in the language of the user.
getQuotePrefix
public final boolean getQuotePrefix()
Gets a value indicating whether the text string in a cell should be prefixed by a single quote mark (e.g., 'text). Use it to store numeric value of a cell as text.
Default value is false
.
- Returns:
true
if the text string in a cell should be prefixed by a single quote mark (e.g., 'text); otherwise,false
.
getRotation
public final int getRotation()
Gets the text rotation in degrees (1/360th of a full circle).
Value must be between -90 and 90 and specifies counterclockwise rotation of the text from the normal position. The first letter of the text is considered the center-point of the arc.
Default value is 0.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Returns:
The text rotation in degrees.
getVerticalAlignment
public final VerticalAlignmentStyle getVerticalAlignment()
Gets the vertical alignment.
Default value is VerticalAlignmentStyle#BOTTOM.
- Returns:
The vertical alignment.
isDefault
public final boolean isDefault()
Gets a value indicating whether the referenced workbook style is default (CellStyleCollection#getNormal) and there are no additional modifications of cell formatting.
- Returns:
true
if the referenced workbook style is default (CellStyleCollection#getNormal) and there are no additional modifications of cell formatting; otherwise,false
.
isLocked
public final boolean isLocked()
Gets a value indicating whether the cell is locked.
Default value is true
.
When cells are marked as "locked" and the workbook is protected or the sheet is protected, then the options specified in the protection settings are prohibited for these cells.
- Returns:
true
if the cell is locked; otherwise,false
.
isShrinkToFit
public final boolean isShrinkToFit()
Gets a value indicating whether the displayed text in the cell should be shrunk to fit the cell width. Not applicable when a cell contains multiple lines of text.
Default value is false
.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Returns:
true
if the displayed text in the cell should be shrunk to fit the cell width; otherwise,false
.
isTextVertical
public final boolean isTextVertical()
Gets a value indicating whether text orientation is vertical.
Default value is false
.
- Returns:
true
if text orientation is vertical; otherwise,false
.
isWrapText
public final boolean isWrapText()
Gets a value indicating whether the text in a cell should be line-wrapped within the cell.
Default value is false
.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Returns:
true
if the text in a cell should be line-wrapped within the cell; otherwise,false
.
setBorders
public final void setBorders(CellBorders borders)
Sets the borders.
If set to null
, borders will be resolved from referenced workbook style.
Diagonal-up (IndividualBorder#DIAGONAL_UP / MultipleBorders#DIAGONAL_UP) and diagonal-down (IndividualBorder#DIAGONAL_DOWN / MultipleBorders#DIAGONAL_DOWN) always share the same color and line style.
- Parameters:
- borders -
The borders.
setFillPattern
public final void setFillPattern(ExcelFillPattern fillPattern)
Sets the fill (cell background).
If set to null
, fill will be resolved from referenced workbook style.
Fill can be either pattern or gradient.
Gradient fill is currently supported in XLSX.
- Parameters:
- fillPattern -
The fill (cell background).
setFont
public final void setFont(ExcelFont font)
Sets the font.
If set to null
, font will be resolved from referenced workbook style.
- Parameters:
- font -
The font.
setFormulaHidden
public final void setFormulaHidden(boolean formulaHidden)
Sets a value indicating whether the contents of the cell will not be displayed in the formula bar.
Default value is false
.
When the cell is hidden and the workbook is protected or the sheet on which the cell resides is protected, then the cell value will be displayed in the cell grid location, but the contents of the cell will not be displayed in the formula bar. This is true for all types of cell content, including formula, text, or numbers.
Following code demonstrates protection formatting:
// 'Protection' formatting group
sheet.getCell("B27").setValue("Locked = ");
sheet.getCell("C27").setValue("false");
sheet.getCell("C27").getStyle().setLocked(false);
sheet.getCell("B28").setValue("FormulaHidden = ");
sheet.getCell("C28").setValue("true");
sheet.getCell("C28").getStyle().setFormulaHidden(true);
- Parameters:
- formulaHidden -
true
if the contents of the cell will not be displayed in the formula bar; otherwise,false
.
setHorizontalAlignment
public final void setHorizontalAlignment(HorizontalAlignmentStyle horizontalAlignment)
Sets the horizontal alignment.
Default value is HorizontalAlignmentStyle#GENERAL.
- Parameters:
- horizontalAlignment -
The horizontal alignment.
setIndent
public final void setIndent(int indent)
Sets the number of spaces (of the CellStyleCollection#getNormal style font) of indentation for text in a cell.
The number of spaces to indent is calculated as following: Number of spaces to indent = CellStyle#getIndent * 3.
Default value is 0.
If #isTextVertical is true
, Horizontal alignment should be set to HorizontalAlignmentStyle#LEFT, HorizontalAlignmentStyle#RIGHT or HorizontalAlignmentStyle#DISTRIBUTED.
If #isTextVertical is false
, Vertical alignment should be set to VerticalAlignmentStyle#BOTTOM, VerticalAlignmentStyle#TOP or VerticalAlignmentStyle#DISTRIBUTED.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Parameters:
- indent -
The number of spaces (of the CellStyleCollection#getNormal style font) of indentation for text in a cell.
setLocked
public final void setLocked(boolean locked)
Sets a value indicating whether the cell is locked.
Default value is true
.
When cells are marked as "locked" and the workbook is protected or the sheet is protected, then the options specified in the protection settings are prohibited for these cells.
Following code demonstrates protection formatting:
// 'Protection' formatting group
sheet.getCell("B27").setValue("Locked = ");
sheet.getCell("C27").setValue("false");
sheet.getCell("C27").getStyle().setLocked(false);
sheet.getCell("B28").setValue("FormulaHidden = ");
sheet.getCell("C28").setValue("true");
sheet.getCell("C28").getStyle().setFormulaHidden(true);
- Parameters:
- locked -
true
if the cell is locked; otherwise,false
.
setNumberFormat
public final void setNumberFormat(String numberFormat)
Sets the number format which indicates how to format and render the numeric value of a cell.
Default value is General.
If set to null
, number format will be resolved from referenced workbook style.
If the value is General or empty string and ExcelCell value is of LocalDateTime type, ISO date/time format will be used as number format.
Custom number format has to be in invariant culture format.
Example:
| ------------- | ---------- | ---------------- |
| Format string | Value | Output |
| \#\#\#\#\# | 123 | 123 |
| 00000 | 123 | 00123 |
| \#,\#\#\# | 1234567890 | 1,234,567,890 |
| 00.00 | 1.2 | 01.20 |
| \#,\#\#0.00 | 1234567890 | 1,234,567,890.00 |
| \#0.\#\#% | 0.092 | 9.2% |
For more information on number format strings consult Microsoft Excel documentation.
Following code demonstrates number formatting:
// 'Number' formatting group
sheet.getCell("B3").setValue("NumberFormat");
sheet.getCell("C3").setValue(1234);
sheet.getCell("C3").getStyle().setNumberFormat("#.##0,00 [$Krakozhian Money Units]");
- Parameters:
- numberFormat -
The number format which indicates how to format and render the numeric value of a cell.
setQuotePrefix
public final void setQuotePrefix(boolean quotePrefix)
Sets a value indicating whether the text string in a cell should be prefixed by a single quote mark (e.g., 'text). Use it to store numeric value of a cell as text.
Default value is false
.
- Parameters:
- quotePrefix -
true
if the text string in a cell should be prefixed by a single quote mark (e.g., 'text); otherwise,false
.
setRotation
public final void setRotation(int rotation)
Sets the text rotation in degrees (1/360th of a full circle).
Value must be between -90 and 90 and specifies counterclockwise rotation of the text from the normal position. The first letter of the text is considered the center-point of the arc.
Default value is 0.
Rotation and #isTextVertical are mutually exclusive.
If Rotation is set, #isTextVertical is set to false
.
If #isTextVertical is set, Rotation is set to 0.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Parameters:
- rotation -
The text rotation in degrees.
setShrinkToFit
public final void setShrinkToFit(boolean shrinkToFit)
Sets a value indicating whether the displayed text in the cell should be shrunk to fit the cell width. Not applicable when a cell contains multiple lines of text.
Default value is false
.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Parameters:
- shrinkToFit -
true
if the displayed text in the cell should be shrunk to fit the cell width; otherwise,false
.
setTextVertical
public final void setTextVertical(boolean textVertical)
Sets the text rotation in degrees (1/360th of a full circle).
Value must be between -90 and 90 and specifies counterclockwise rotation of the text from the normal position. The first letter of the text is considered the center-point of the arc.
Default value is 0.
Rotation and #isTextVertical are mutually exclusive.
If Rotation is set, #isTextVertical is set to false
.
If #isTextVertical is set, Rotation is set to 0.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Parameters:
- textVertical -
The text rotation in degrees.
setVerticalAlignment
public final void setVerticalAlignment(VerticalAlignmentStyle verticalAlignment)
Sets the vertical alignment.
Default value is VerticalAlignmentStyle#BOTTOM.
- Parameters:
- verticalAlignment -
The vertical alignment.
setWrapText
public final void setWrapText(boolean wrapText)
Sets a value indicating whether the text in a cell should be line-wrapped within the cell.
Default value is false
.
See HorizontalAlignmentStyle or VerticalAlignmentStyle for an example on alignment formatting
- Parameters:
- wrapText -
true
if the text in a cell should be line-wrapped within the cell; otherwise,false
.