Sheet kit command

cell.formatText

Format Characters

Formats characters inside one text cell (bold, italic, strike, underline, font, size, colour) from start to end, leaving the rest of the cell's text as it was.

Kit
Sheet 0.1.0 (.xlsx (and opens .xlsm, .xls, .xltx, .csv, .ods, .xlsb))
Changes the document
yes

Parameters

Parameters of cell.formatText
NameTypeRequiredDescription
boldbooleanno
cellstringnolike B2
colorstringnoa colour such as #C00000
endnumbernocharacters, end exclusive; the whole text by default
italicbooleanno
namestringno
sheetinteger | stringno
sizenumberno
startintegerno
strikebooleanno
toggle"bold" | "italic" | "underline" | "strike" | "superscript" | "subscript"no
underlineboolean | stringno
vertAlign"superscript" | "subscript" | "baseline"no

Call through sheet_run

text
sheet_run {
  "path": "<file>.xlsx",
  "steps": [{ "command": "cell.formatText" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: bold, cell, color, end, italic, name, sheet, size, start, strike, toggle, underline, vertAlign. sheet_run answers the step’s result in completed[i].result.

Result

The kit gives no result schema for this command.

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "bold": {
      "type": "boolean"
    },
    "cell": {
      "description": "like B2",
      "type": "string"
    },
    "color": {
      "description": "a colour such as #C00000",
      "type": "string"
    },
    "end": {
      "description": "characters, end exclusive; the whole text by default",
      "type": "number"
    },
    "italic": {
      "type": "boolean"
    },
    "name": {
      "type": "string"
    },
    "sheet": {
      "oneOf": [
        {
          "description": "a sheet position counted from 0",
          "type": "integer"
        },
        {
          "description": "a sheet name",
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Sheet"
      ]
    },
    "size": {
      "type": "number"
    },
    "start": {
      "default": 0,
      "type": "integer"
    },
    "strike": {
      "type": "boolean"
    },
    "toggle": {
      "enum": [
        "bold",
        "italic",
        "underline",
        "strike",
        "superscript",
        "subscript"
      ],
      "type": "string"
    },
    "underline": {
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "description": "double, singleAccounting or doubleAccounting",
          "type": "string"
        }
      ]
    },
    "vertAlign": {
      "enum": [
        "superscript",
        "subscript",
        "baseline"
      ],
      "type": "string"
    }
  },
  "returns": "{cell, start, end, runs}: formats part of a text cell's characters (rich text)",
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (sheet_commands through @kition/[email protected], built from KitionAI/kition-sheet@82f13b2). As data: commands.jsonl.