Table kit command

table.file.render

Render a preview image

Draws the table, a view, some of its rows, a field, one record's cell or a dashboard as the editor shows them, as a PNG at a scale up to 2, such as the target a diagnostic names; changes nothing.

Kit
Table 0.4.0 (.ktable)
Changes the document
no

Parameters

Parameters of table.file.render
NameTypeRequiredDescription
maxSizeintegernoThe longest side in pixels, 1 to 4096; default 4096.
scalenumbernoDevice pixels per document pixel, above 0 and up to 2; default 1.
slideintegernoWithout target: the table at this position among the tables, counted from 0 (a host's part preview).
targetobjectnoWhat to draw: a table or a view by id (table, view), or a diagnostic's target as the check answered it. table is a table's id (its first view), view a view's id (the records it shows, filtered and in its order). path is tables/<id> (the table as the editor opens it), tables/<id>/views/<id> (a view, the records it shows), tables/<id>/fields/<id>, tables/<id>/records/<id> or tables/<id>/records/<id>/fields/<id> (every field and record of the table, that one outlined and the picture framed around it), or dashboards/<id>; sheet, a table's title, when there is no path. rows [from, to] draws only the records at those positions of the table or view, counted from 1 as the grid numbers them. Default: the first table's first view, whatever the editor shows.

Call through table_run

text
table_run {
  "path": "<file>.ktable",
  "steps": [{ "command": "table.file.render" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: maxSize, scale, slide, target. table_run answers the step’s result in completed[i].result.

Result

Result of table.file.render
NameTypeRequiredDescription
errorobjectnoWhy the call failed (A18); the file is as it was.
heightintegernoIts height in pixels.
mimeTypestringnoimage/png.
pngstringnoBase64 of the PNG.
scalenumbernoThe scale it was drawn at.
tableIdinteger | nullnoThe table drawn; null for a dashboard.
viewIdinteger | nullnoThe view drawn; null without one.
widthintegernoIts width in pixels.
Result JSON Schema
json
{
  "additionalProperties": false,
  "properties": {
    "error": {
      "additionalProperties": false,
      "description": "Why the call failed (A18); the file is as it was.",
      "properties": {
        "code": {
          "enum": [
            "invalid-params",
            "invalid-op",
            "invalid-value",
            "not-found",
            "read-only",
            "unknown-command",
            "command-failed",
            "not-open",
            "draft-required",
            "not-allowed",
            "unsupported",
            "unavailable",
            "failed"
          ],
          "type": "string"
        },
        "index": {
          "description": "The failing step or operation.",
          "type": "integer"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "height": {
      "description": "Its height in pixels.",
      "type": "integer"
    },
    "mimeType": {
      "description": "image/png.",
      "type": "string"
    },
    "png": {
      "description": "Base64 of the PNG.",
      "type": "string"
    },
    "scale": {
      "description": "The scale it was drawn at.",
      "type": "number"
    },
    "tableId": {
      "description": "The table drawn; null for a dashboard.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "viewId": {
      "description": "The view drawn; null without one.",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ]
    },
    "width": {
      "description": "Its width in pixels.",
      "type": "integer"
    }
  },
  "type": "object"
}

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "maxSize": {
      "description": "The longest side in pixels, 1 to 4096; default 4096.",
      "type": "integer"
    },
    "scale": {
      "description": "Device pixels per document pixel, above 0 and up to 2; default 1.",
      "type": "number"
    },
    "slide": {
      "description": "Without target: the table at this position among the tables, counted from 0 (a host's part preview).",
      "type": "integer"
    },
    "target": {
      "additionalProperties": false,
      "description": "What to draw: a table or a view by id (table, view), or a diagnostic's target as the check answered it. table is a table's id (its first view), view a view's id (the records it shows, filtered and in its order). path is tables/<id> (the table as the editor opens it), tables/<id>/views/<id> (a view, the records it shows), tables/<id>/fields/<id>, tables/<id>/records/<id> or tables/<id>/records/<id>/fields/<id> (every field and record of the table, that one outlined and the picture framed around it), or dashboards/<id>; sheet, a table's title, when there is no path. rows [from, to] draws only the records at those positions of the table or view, counted from 1 as the grid numbers them. Default: the first table's first view, whatever the editor shows.",
      "properties": {
        "path": {
          "description": "tables/<id>[/views/<id> | /fields/<id> | /records/<id>[/fields/<id>]] or dashboards/<id>, with the ids table_inspect answers.",
          "type": "string"
        },
        "rows": {
          "description": "[from, to]: the records at these positions, counted from 1, both included.",
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        "sheet": {
          "description": "A table's title (a diagnostic gives it beside path).",
          "type": "string"
        },
        "table": {
          "description": "A table's id, as table_inspect lists it: the table as its first view shows it.",
          "type": "integer"
        },
        "view": {
          "description": "A view's id, as table_inspect lists it: the records it shows, in its order.",
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}

Generated from kition-sdk packages/script/kits/table.ts and the kit itself (kition-table@ee73209). As data: commands.jsonl.