Class CellStyle

java.lang.Object
io.keikai.axyra.sheets.style.CellStyle

public final class CellStyle extends Object
An immutable cell style — font, fill, borders, alignment, number format, and protection. Build one with builder() and apply it via Range.setStyle(...); read one back via Range.style() and edit an existing style via toBuilder().

Crosses the JNI boundary as a single flat JSON object (the engine dedups identical styles into one id). Colors are fully typed: theme / indexed / automatic colors read back as the corresponding Color form (see Color.isTheme() etc.), not as opaque strings.

Rich per-run text is not represented here (see RichText).

  • Method Details

    • builder

      public static CellStyle.Builder builder()
    • toBuilder

      public CellStyle.Builder toBuilder()
      A builder pre-loaded with this style's attributes — the edit-existing workflow: cell.style().toBuilder().bold().build().
    • toJson

      public String toJson()
      Package-private: the flat JSON crossed to the engine.
    • fromJson

      public static CellStyle fromJson(String json)
      Package-private: rebuild from the engine's resolved-style JSON.
    • fontName

      public String fontName()
    • fontSize

      public double fontSize()
    • bold

      public boolean bold()
    • italic

      public boolean italic()
    • strikethrough

      public boolean strikethrough()
    • underline

      public Underline underline()
    • fontColor

      public Color fontColor()
      The font color (RGB, theme, indexed, or automatic), or null.
    • fillColor

      public Color fillColor()
      The fill (foreground) color, or null.
    • fillBackgroundColor

      public Color fillBackgroundColor()
      The fill background (pattern) color, or null.
    • fillPattern

      public PatternType fillPattern()
      The fill pattern type (solid / none / gray125 / …).
    • fontVertical

      public FontVertical fontVertical()
      Font vertical alignment (baseline / superscript / subscript).
    • fontCharset

      public int fontCharset()
      Font character set (0 = ANSI, 1 = DEFAULT, …).
    • fontFamily

      public int fontFamily()
      Font-family class: 0 = n/a, 1 = Roman, 2 = Swiss, 3 = Modern, 4 = Script, 5 = Decorative.
    • fontScheme

      public String fontScheme()
      Font theme scheme ("major", "minor", or empty).
    • horizontalAlign

      public HAlign horizontalAlign()
    • verticalAlign

      public VAlign verticalAlign()
    • shrinkToFit

      public boolean shrinkToFit()
      Whether text shrinks to fit the cell rather than wrapping or overflowing (ECMA-376 §18.8.1 alignment@shrinkToFit).
    • quotePrefix

      public boolean quotePrefix()
      Whether the cell's text was entered with a leading apostrophe (ECMA-376 §18.8.45 xf@quotePrefix), which keeps a number-looking value as text. Excel hides the apostrophe but records the flag.

      Read-only: it records how a value was typed, so applying a style must not stamp one onto a cell that was never entered that way. There is deliberately no builder method.

    • wrapText

      public boolean wrapText()
    • textRotation

      public int textRotation()
    • indent

      public int indent()
    • numberFormat

      public String numberFormat()
    • hasGradientFill

      public boolean hasGradientFill()
      Whether this style carries a gradient fill.
    • gradientType

      public String gradientType()
      The gradient kind: "linear" (rotated by gradientDegree()) or "path" (shape-bounded, from CellStyle.Builder.pathGradientFill(io.keikai.axyra.sheets.style.Color...)), or null when the fill is not a gradient.
    • gradientDegree

      public int gradientDegree()
      The gradient rotation in whole degrees (ECMA-376 Part 1 §18.8.24 gradientFill/@degree), or -1 when the fill is not a gradient.
    • gradientStops

      public List<GradientStop> gradientStops()
      The gradient color stops in position order (§18.8.38); empty when the fill is not a gradient. The read-back counterpart of CellStyle.Builder.gradientFill(int, Color...).
    • border

      public BorderEdge border(Side side)
      The given border edge: line style plus color. Never null — an absent edge reads back as BorderStyle.NONE with a null color (see BorderEdge.isPresent()).
    • borderTop

      public BorderEdge borderTop()
      The top border edge.
    • borderBottom

      public BorderEdge borderBottom()
      The bottom border edge.
    • borderLeft

      public BorderEdge borderLeft()
      The left border edge.
    • borderRight

      public BorderEdge borderRight()
      The right border edge.
    • borderDiagonal

      public BorderEdge borderDiagonal()
      The diagonal border edge (direction: diagonalDown() / diagonalUp()).
    • diagonalDown

      public boolean diagonalDown()
      Whether the diagonal border runs top-left → bottom-right.
    • diagonalUp

      public boolean diagonalUp()
      Whether the diagonal border runs bottom-left → top-right.
    • locked

      public boolean locked()
    • hidden

      public boolean hidden()