Style
Overview
Style is a class in Aspose.Cells FOSS for Java.
Represents the full style of a cell: font, borders, alignment, fill, number format, and protection.
This class provides 38 methods for working with Style objects in Java programs.
Available methods include: Style, clone, getBackgroundColor, getBorders, getCustom, getFont, getForegroundColor, getHorizontalAlignment, getIndentLevel, getNumber, getNumberFormat, getPattern, and 26 additional methods.
All exported members are accessible to any Java application after installing the Aspose.Cells FOSS for Java package.
Properties: backgroundColor, borders, custom, font, foregroundColor, formulaHidden, and 12 more.
Description
Style is a class in the Aspose.Cells FOSS library for Java that exposes 37 methods and 18 properties for programmatic use.
Core capabilities include: font; borders; horizontalalignmenttype. These operations enable developers to integrate style functionality directly into Java applications.
The class also provides the font property (returns the font), the borders property (returns the borders), the horizontalAlignment property (returns the horizontal alignment).
Instances are created through a single constructor that initializes the object with default values.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
font | Font | Read | Returns the font. |
borders | Borders | Read | Returns the borders. |
horizontalAlignment | HorizontalAlignmentType | Read | Returns the horizontal alignment. |
verticalAlignment | VerticalAlignmentType | Read | Returns the vertical alignment. |
textWrapped | boolean | Read | Indicates whether wrap text. |
indentLevel | int | Read | Returns the indent level. |
rotationAngle | int | Read | Returns the text rotation. |
shrinkToFit | boolean | Read | Indicates whether shrink to fit. |
readingOrder | int | Read | Returns the reading order. |
relativeIndent | int | Read | Returns the relative indent. |
pattern | FillPattern | Read | Returns the pattern. |
foregroundColor | Color | Read | Returns the foreground color. |
backgroundColor | Color | Read | Returns the background color. |
number | int | Read | Built-in number format index (0 = General). |
custom | String | Read | Custom format string (e.g. |
numberFormat | String | Read | Combined number format getter: returns the custom format string if set, |
| otherwise returns the built-in format string for the current {@code number} index. | |||
locked | boolean | Read | Whether the cell is locked when the sheet is protected. |
formulaHidden | boolean | Read | Whether the cell formula is hidden when the sheet is protected. |
Methods
| Signature | Description |
|---|---|
Style() | Creates a default style (Calibri 11pt, no borders, general alignment, locked). |
getFont() → Font | Returns the font. |
setFont(font: Font) | Sets the font. |
getBorders() → Borders | Returns the borders. |
setBorders(borders: Borders) | Sets the borders. |
getHorizontalAlignment() → HorizontalAlignmentType | Returns the horizontal alignment. |
setHorizontalAlignment(value: HorizontalAlignmentType) | Sets the horizontal alignment. |
getVerticalAlignment() → VerticalAlignmentType | Returns the vertical alignment. |
setVerticalAlignment(value: VerticalAlignmentType) | Sets the vertical alignment. |
isTextWrapped() → boolean | Indicates whether wrap text. |
setTextWrapped(value: boolean) | Sets the text wrapped. |
getIndentLevel() → int | Returns the indent level. |
setIndentLevel(value: int) | Sets the indent level. |
getRotationAngle() → int | Returns the text rotation. |
setRotationAngle(value: int) | Sets the rotation angle. |
getShrinkToFit() → boolean | Indicates whether shrink to fit. |
setShrinkToFit(value: boolean) | Sets the shrink to fit. |
getReadingOrder() → int | Returns the reading order. |
setReadingOrder(value: int) | Sets the reading order. |
getRelativeIndent() → int | Returns the relative indent. |
setRelativeIndent(value: int) | Sets the relative indent. |
getPattern() → FillPattern | Returns the pattern. |
setPattern(value: FillPattern) | Sets the pattern. |
getForegroundColor() → Color | Returns the foreground color. |
setForegroundColor(value: Color) | Sets the foreground color. |
getBackgroundColor() → Color | Returns the background color. |
setBackgroundColor(value: Color) | Sets the background color. |
getNumber() → int | Built-in number format index (0 = General). |
setNumber(value: int) | Sets the number. |
getCustom() → String | Custom format string (e.g. |
setCustom(value: String) | Sets the custom. |
getNumberFormat() → String | Combined number format getter: returns the custom format string if set, |
| otherwise returns the built-in format string for the current {@code number} index. | |
setNumberFormat(formatCode: String) | Combined number format setter: if {@code formatCode} matches a built-in format, |
| sets {@link #number} to its ID and clears {@link #custom}; | |
| otherwise sets {@link #number} to 0 and stores the code in {@link #custom}. | |
isLocked() → boolean | Whether the cell is locked when the sheet is protected. |
setLocked(value: boolean) | Sets the locked. |
isFormulaHidden() → boolean | Whether the cell formula is hidden when the sheet is protected. |
setFormulaHidden(value: boolean) | Sets whether the cell formula is hidden. |
clone() → Style | Creates a copy of this instance. |