---
title: "cell.formatText: Format Characters — Sheet kit command — Kition"
description: "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."
canonical: "https://developer.kition.ai/docs/kits/sheet/commands/cell.formatText"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/sheet/commands/cell.formatText](https://developer.kition.ai/docs/kits/sheet/commands/cell.formatText)

# 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)); reference: [Sheet kit commands](https://developer.kition.ai/docs/kits/sheet.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `bold` | `boolean` | no |  |
| `cell` | `string` | no | like B2 |
| `color` | `string` | no | a colour such as #C00000 |
| `end` | `number` | no | characters, end exclusive; the whole text by default |
| `italic` | `boolean` | no |  |
| `name` | `string` | no |  |
| `sheet` | `integer \| string` | no |  |
| `size` | `number` | no |  |
| `start` | `integer` | no |  |
| `strike` | `boolean` | no |  |
| `toggle` | `"bold" \| "italic" \| "underline" \| "strike" \| "superscript" \| "subscript"` | no |  |
| `underline` | `boolean \| string` | no |  |
| `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/sheet-darwin-arm64@0.1.0 and the kit itself (sheet_commands through @kition/cli@0.1.1, built from KitionAI/kition-sheet@82f13b2).
