Class RichText

java.lang.Object
io.keikai.axyra.sheets.content.RichText

public final class RichText extends Object
Rich (multi-run) cell text — a sequence of runs, each with its own optional font overrides (bold, italic, underline, strike, name, size, color). Apply with Cell.setRichText(...); read back with Cell.richText() and inspect the runs via run(int) / runs(). Crosses the boundary as a JSON array.

 cell.setRichText(RichText.builder()
         .run("Total: ")
         .run("42", RichText.run().bold().color(Color.RED))
         .build());
 
  • Method Details

    • builder

      public static RichText.Builder builder()
      A builder; add runs in reading order with RichText.Builder.run(String).
    • toBuilder

      public RichText.Builder toBuilder()
      A builder pre-loaded with this text's runs, for read–modify–write round-trips.
    • run

      public static RichText.Run run()
      A per-run style spec (see RichText.Run).
    • toJson

      public String toJson()
      The runs as a JSON array crossed to the engine.
    • fromJson

      public static RichText fromJson(String json)
      Rebuild from the engine's read-back JSON (see Cell.richText()).
    • runCount

      public int runCount()
      Number of runs.
    • text

      public String text()
      The flat cell text — the concatenation of every run's text.
    • run

      public RichText.RunInfo run(int index)
      The run at index as a typed view.
      Parameters:
      index - 0-based run index
      Throws:
      IndexOutOfBoundsException - if index is outside [0, runCount())
    • runs

      public List<RichText.RunInfo> runs()
      Every run as a typed view, in order.