Class Cell

java.lang.Object
io.keikai.axyra.sheets.Cell

public final class Cell extends Object
A single cell — a lightweight (Sheet, row, col) view. Holds no native resource; every accessor delegates to a 1x1 Range (one JNI crossing each). For bulk work use Range directly.
  • Method Details

    • row

      public int row()
      0-based row.
    • col

      public int col()
      0-based column.
    • value

      public CellValue value()
      The cell's value (formula cells return their evaluated value).
    • formattedText

      public String formattedText()
      The cell's display text: its value rendered through the cell style's number format under the workbook display locale (Workbook.setLocale(java.lang.String); default en-US). Blank cells return an empty string.
    • setValue

      public void setValue(CellValue value)
      Set the cell's value, clearing any formula.
    • setDate

      public void setDate(LocalDate date)
      Sets a date: the value becomes the Excel serial for date (honoring the workbook's 1900/1904 date system), and a yyyy-mm-dd number format is applied when the cell still has General (an existing format is kept). Dates before March 1900 use the standard serial formula and thus differ from Excel's historical leap-year bug by one day.
    • setDateTime

      public void setDateTime(LocalDateTime dateTime)
      Sets a date-time: the serial carries the day fraction (second precision) and a yyyy-mm-dd hh:mm:ss format is applied when the cell still has General.
    • dateValue

      public LocalDate dateValue()
      The cell's value interpreted as a date (the serial's day part under the workbook's date system), or null when the cell is not numeric.
    • dateTimeValue

      public LocalDateTime dateTimeValue()
      The cell's value interpreted as a date-time (day fraction rounded to seconds), or null when the cell is not numeric.
    • formula

      public String formula()
      The cell's formula source, or null if it is not a formula cell. It reads the same for a workbook built here and one opened from a file: without array-formula braces and without the _xlfn. prefixes the file format adds to newer functions.
    • setFormula

      public void setFormula(String formula)
      Set the cell's formula (empty string clears it).
    • setFormulaLocalized

      public void setFormulaLocalized(String formula, String locale)
      Set the cell's formula written in a locale's display form — translated function names (e.g. German SUMME, French SOMME) and the ; argument separator. It is translated to the en-US canonical form (English names, , separator) before storage. locale is a language tag such as "de" or "fr-FR"; an unknown locale stores the formula unchanged. Function names inside string literals are never translated.
    • formulaLocalized

      public String formulaLocalized(String locale)
      The cell's formula rendered in locale's display form (translated function names + ; separator), or null for a non-formula cell. The inverse of setFormulaLocalized(java.lang.String, java.lang.String).
    • clear

      public void clear()
      Clear the cell (value and formula).
    • setRichText

      public void setRichText(RichText richText)
      Set this cell to rich (multi-run) formatted text.
    • richText

      public RichText richText()
      The cell's rich (multi-run) text with per-run formatting, or null if the cell is not rich text. The returned value feeds straight back into setRichText(io.keikai.axyra.sheets.content.RichText) (round-trip safe).
    • richRunCount

      public int richRunCount()
      Number of rich-text runs on this cell (0 if it is not rich text).
    • style

      public CellStyle style()
      The cell's resolved style.
    • setStyle

      public void setStyle(CellStyle style)
      Apply a style to this cell (the engine dedups identical styles).
    • comment

      public Comment comment()
      The cell's comment, or null.
    • setComment

      public void setComment(String author, String text)
      Attach or replace the cell's comment.
    • setCommentLayout

      public boolean setCommentLayout(double widthPt, double heightPt, boolean visible)
      Set the note-shape layout of this cell's existing comment: box size in points and whether the note stays visible without hovering (Excel's "Show Comment"). Returns whether a comment was present. Imported note geometry is regenerated from these values on the next save.
    • setComment

      public void setComment(Comment comment)
    • setRichComment

      public void setRichComment(String author, CommentRun... runs)
      Attach or replace a RICH-TEXT comment (note): each CommentRun carries per-run font overrides (ECMA-376 Part 1 §18.7.7). The comment's plain Comment.text() becomes the concatenation of the run texts.
      Throws:
      AxyraException - when no runs are given or a run has empty text
    • commentRuns

      public List<CommentRun> commentRuns()
      The comment's rich-text runs — empty for a plain-text note, null when the cell has no comment.
    • removeComment

      public void removeComment()
      Remove any comment.
    • threadedComments

      public List<ThreadedComment> threadedComments()
      This cell's comment threads: each root ThreadedComment carries its replies. Empty when the cell has none.
    • addThreadedComment

      public String addThreadedComment(String author, String text)
      Start a new comment thread on this cell; returns the generated comment id (a braced GUID). The author is registered in the workbook persons list when new.
    • addThreadedReply

      public String addThreadedReply(String parentId, String author, String text)
      Reply to the thread containing parentId (a root or reply id; replies attach to the thread root, like Excel). Returns the new reply id, or null when the parent does not exist.
    • setThreadedCommentResolved

      public boolean setThreadedCommentResolved(String id, boolean resolved)
      Resolve / reopen the thread containing id; returns whether it matched a comment on this sheet.
    • removeThreadedComment

      public boolean removeThreadedComment(String id)
      Remove the comment with id — a root id removes its whole thread, a reply id removes just that reply. Returns whether anything was removed.
    • hyperlink

      public Hyperlink hyperlink()
      The cell's hyperlink, or null.
    • setHyperlink

      public void setHyperlink(String url)
      Attach or replace a URL hyperlink.
    • setHyperlink

      public void setHyperlink(Hyperlink link)
      Attach or replace the cell's hyperlink.
    • removeHyperlink

      public void removeHyperlink()
      Remove any hyperlink.