Class FormControl

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

public final class FormControl extends Object
A worksheet form control (immutable): check box, option button, button, combo box, list box, scroll bar, spin button, edit box, label or group box — the classic Form Controls group on Excel's Developer tab. Add with Sheet.addFormControl(...); read back with Sheet.formControls(); replace with Sheet.updateFormControl(index, control). Crosses the boundary as flat JSON.

The anchor is a two-cell rectangle in 0-based row/column coordinates, optionally refined by EMU offsets inside the corner cells. Per-type state: checked (check box / option button), listFillRange + selectedIndex + dropLines (combo / list box), value/min/max/increment/page (scroll bar / spin button), text (caption shown by captioned controls), linkedCell (cell reflecting the control's state) and threeD (the 3-D shading flag of the Format Control dialog).

Reference: ECMA-376 Part 1 §18.3.1.13 (controls) plus the <formControlPr> control-properties part.

  • Method Details

    • checkBox

      public static FormControl.Builder checkBox(String name)
      A check box; set state with .checked(true).
    • optionButton

      public static FormControl.Builder optionButton(String name)
      An option (radio) button; set state with .checked(true).
    • button

      public static FormControl.Builder button(String name)
      A push button; the caption comes from .text(...) or the name.
    • comboBox

      public static FormControl.Builder comboBox(String name)
      A drop-down combo box; feed it with .listFillRange("F1:F5").
    • listBox

      public static FormControl.Builder listBox(String name)
      A list box; feed it with .listFillRange("F1:F5").
    • scrollBar

      public static FormControl.Builder scrollBar(String name)
      A scroll bar; configure .range(min, max) / .value(v).
    • spinButton

      public static FormControl.Builder spinButton(String name)
      A spin button; configure .range(min, max) / .value(v).
    • editBox

      public static FormControl.Builder editBox(String name)
      An edit box (legacy dialog-sheet control).
    • label

      public static FormControl.Builder label(String name)
      A static text label.
    • groupBox

      public static FormControl.Builder groupBox(String name)
      A group box frame (visually groups option buttons).
    • of

      public static FormControl.Builder of(FormControlType type, String name)
      A control of any FormControlType.
    • toBuilder

      public FormControl.Builder toBuilder()
      A builder pre-loaded with this control, for read–modify–write round-trips.
    • toJson

      public String toJson()
    • fromJson

      public static FormControl fromJson(String json)
    • type

      public FormControlType type()
    • name

      public String name()
      The shape name, e.g. "Check Box 1".
    • fromRow

      public int fromRow()
    • fromColumn

      public int fromColumn()
    • toRow

      public int toRow()
    • toColumn

      public int toColumn()
    • linkedCell

      public String linkedCell()
      Linked cell in A1 form (e.g. "A1", "Sheet2!B3"), or null.
    • listFillRange

      public String listFillRange()
      Items source range in A1 form for combo / list boxes, or null.
    • checked

      public boolean checked()
      Check box / option button state.
    • selectedIndex

      public int selectedIndex()
      1-based selected item index of a combo / list box; 0 = no selection.
    • dropLines

      public int dropLines()
      Visible drop-down rows of a combo box (Excel's default is 8).
    • value

      public int value()
      Current value of a scroll bar / spin button.
    • min

      public int min()
    • max

      public int max()
    • increment

      public int increment()
      Incremental change of a scroll bar / spin button.
    • page

      public int page()
      Page change of a scroll bar.
    • text

      public String text()
      Caption text painted by captioned controls, or null (name is used).
    • threeD

      public boolean threeD()
      The 3-D shading flag of the Format Control dialog.