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.

Properties

NameTypeAccessDescription
fontFontReadReturns the font.
bordersBordersReadReturns the borders.
horizontalAlignmentHorizontalAlignmentTypeReadReturns the horizontal alignment.
verticalAlignmentVerticalAlignmentTypeReadReturns the vertical alignment.
textWrappedbooleanReadIndicates whether wrap text.
indentLevelintReadReturns the indent level.
rotationAngleintReadReturns the text rotation.
shrinkToFitbooleanReadIndicates whether shrink to fit.
readingOrderintReadReturns the reading order.
relativeIndentintReadReturns the relative indent.
patternFillPatternReadReturns the pattern.
foregroundColorColorReadReturns the foreground color.
backgroundColorColorReadReturns the background color.
numberintReadBuilt-in number format index (0 = General).
customStringReadCustom format string (e.g.
numberFormatStringReadCombined number format getter: returns the custom format string if set,
otherwise returns the built-in format string for the current {@code number} index.
lockedbooleanReadWhether the cell is locked when the sheet is protected.
formulaHiddenbooleanReadWhether the cell formula is hidden when the sheet is protected.

Methods

SignatureDescription
Style()Creates a default style (Calibri 11pt, no borders, general alignment, locked).
getFont()FontReturns the font.
setFont(font: Font)Sets the font.
getBorders()BordersReturns the borders.
setBorders(borders: Borders)Sets the borders.
getHorizontalAlignment()HorizontalAlignmentTypeReturns the horizontal alignment.
setHorizontalAlignment(value: HorizontalAlignmentType)Sets the horizontal alignment.
getVerticalAlignment()VerticalAlignmentTypeReturns the vertical alignment.
setVerticalAlignment(value: VerticalAlignmentType)Sets the vertical alignment.
isTextWrapped()booleanIndicates whether wrap text.
setTextWrapped(value: boolean)Sets the text wrapped.
getIndentLevel()intReturns the indent level.
setIndentLevel(value: int)Sets the indent level.
getRotationAngle()intReturns the text rotation.
setRotationAngle(value: int)Sets the rotation angle.
getShrinkToFit()booleanIndicates whether shrink to fit.
setShrinkToFit(value: boolean)Sets the shrink to fit.
getReadingOrder()intReturns the reading order.
setReadingOrder(value: int)Sets the reading order.
getRelativeIndent()intReturns the relative indent.
setRelativeIndent(value: int)Sets the relative indent.
getPattern()FillPatternReturns the pattern.
setPattern(value: FillPattern)Sets the pattern.
getForegroundColor()ColorReturns the foreground color.
setForegroundColor(value: Color)Sets the foreground color.
getBackgroundColor()ColorReturns the background color.
setBackgroundColor(value: Color)Sets the background color.
getNumber()intBuilt-in number format index (0 = General).
setNumber(value: int)Sets the number.
getCustom()StringCustom format string (e.g.
setCustom(value: String)Sets the custom.
getNumberFormat()StringCombined 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()booleanWhether the cell is locked when the sheet is protected.
setLocked(value: boolean)Sets the locked.
isFormulaHidden()booleanWhether the cell formula is hidden when the sheet is protected.
setFormulaHidden(value: boolean)Sets whether the cell formula is hidden.
clone()StyleCreates a copy of this instance.

See Also