Skip to main content
Alpha: Document API is currently alpha and subject to breaking changes.

Summary

Set borders on a table using a target set or per-edge patch.
  • Operation ID: tables.setBorders
  • API member path: editor.doc.tables.setBorders(...)
  • Mutates document: yes
  • Idempotency: idempotent
  • Supports tracked mode: no
  • Supports dry run: yes
  • Deterministic target resolution: yes

Expected result

Returns a TableMutationResult receipt. Does not perform NO_OP detection.

Input fields

Variant 1.1 (target.kind=“block”)

FieldTypeRequiredDescription
applyToenumyes"all", "outside", "inside", "top", "bottom", "left", "right", "insideH", "insideV"
borderobject \nullyesOne of: object, null
mode"applyTo"yesConstant: "applyTo"
targetBlockNodeAddressyesBlockNodeAddress
target.kind"block"yesConstant: "block"
target.nodeIdstringyes
target.nodeTypeenumyes"paragraph", "heading", "listItem", "table", "tableRow", "tableCell", "tableOfContents", "image", "sdt"

Variant 1.2 (mode=“applyTo”)

FieldTypeRequiredDescription
applyToenumyes"all", "outside", "inside", "top", "bottom", "left", "right", "insideH", "insideV"
borderobject \nullyesOne of: object, null
mode"applyTo"yesConstant: "applyTo"
nodeIdstringyes

Variant 2.1 (target.kind=“block”)

FieldTypeRequiredDescription
edgesobjectyes
edges.bottomobject \nullnoOne of: object, null
edges.insideHobject \nullnoOne of: object, null
edges.insideVobject \nullnoOne of: object, null
edges.leftobject \nullnoOne of: object, null
edges.rightobject \nullnoOne of: object, null
edges.topobject \nullnoOne of: object, null
mode"edges"yesConstant: "edges"
targetBlockNodeAddressyesBlockNodeAddress
target.kind"block"yesConstant: "block"
target.nodeIdstringyes
target.nodeTypeenumyes"paragraph", "heading", "listItem", "table", "tableRow", "tableCell", "tableOfContents", "image", "sdt"

Variant 2.2 (mode=“edges”)

FieldTypeRequiredDescription
edgesobjectyes
edges.bottomobject \nullnoOne of: object, null
edges.insideHobject \nullnoOne of: object, null
edges.insideVobject \nullnoOne of: object, null
edges.leftobject \nullnoOne of: object, null
edges.rightobject \nullnoOne of: object, null
edges.topobject \nullnoOne of: object, null
mode"edges"yesConstant: "edges"
nodeIdstringyes

Example request

{
  "applyTo": "all",
  "border": {
    "color": "example",
    "lineStyle": "example",
    "lineWeightPt": 12.5
  },
  "mode": "applyTo",
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "paragraph"
  }
}

Output fields

Variant 1 (success=true)

FieldTypeRequiredDescription
successtrueyesConstant: true
tableTableAddressnoTableAddress
table.kind"block"noConstant: "block"
table.nodeIdstringno
table.nodeType"table"noConstant: "table"
trackedChangeRefsEntityAddress[]no

Variant 2 (success=false)

FieldTypeRequiredDescription
failureobjectyes
failure.codeenumyes"NO_OP", "INVALID_TARGET", "TARGET_NOT_FOUND", "CAPABILITY_UNAVAILABLE"
failure.detailsanyno
failure.messagestringyes
successfalseyesConstant: false
When present, result.table is the follow-up address to reuse after this call. For non-destructive table-targeted mutations, pass result.table.nodeId to the next table operation instead of re-running find(). Destructive operations may omit table.

Example response

{
  "success": true,
  "table": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "table"
  },
  "trackedChangeRefs": [
    {
      "entityId": "entity-789",
      "entityType": "comment",
      "kind": "entity"
    }
  ]
}

Pre-apply throws

  • TARGET_NOT_FOUND
  • INVALID_TARGET
  • CAPABILITY_UNAVAILABLE

Non-applied failure codes

  • INVALID_TARGET
  • INVALID_INPUT

Raw schemas

{
  "oneOf": [
    {
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "target"
          ]
        },
        {
          "required": [
            "nodeId"
          ]
        }
      ],
      "properties": {
        "applyTo": {
          "enum": [
            "all",
            "outside",
            "inside",
            "top",
            "bottom",
            "left",
            "right",
            "insideH",
            "insideV"
          ]
        },
        "border": {
          "oneOf": [
            {
              "additionalProperties": false,
              "properties": {
                "color": {
                  "pattern": "^([0-9A-Fa-f]{6}|auto)$",
                  "type": "string"
                },
                "lineStyle": {
                  "type": "string"
                },
                "lineWeightPt": {
                  "exclusiveMinimum": 0,
                  "type": "number"
                }
              },
              "required": [
                "lineStyle",
                "lineWeightPt",
                "color"
              ],
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "mode": {
          "const": "applyTo"
        },
        "nodeId": {
          "type": "string"
        },
        "target": {
          "$ref": "#/$defs/BlockNodeAddress"
        }
      },
      "required": [
        "mode",
        "applyTo",
        "border"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "target"
          ]
        },
        {
          "required": [
            "nodeId"
          ]
        }
      ],
      "properties": {
        "edges": {
          "additionalProperties": false,
          "properties": {
            "bottom": {
              "oneOf": [
                {
                  "additionalProperties": false,
                  "properties": {
                    "color": {
                      "pattern": "^([0-9A-Fa-f]{6}|auto)$",
                      "type": "string"
                    },
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    }
                  },
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ],
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            },
            "insideH": {
              "oneOf": [
                {
                  "additionalProperties": false,
                  "properties": {
                    "color": {
                      "pattern": "^([0-9A-Fa-f]{6}|auto)$",
                      "type": "string"
                    },
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    }
                  },
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ],
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            },
            "insideV": {
              "oneOf": [
                {
                  "additionalProperties": false,
                  "properties": {
                    "color": {
                      "pattern": "^([0-9A-Fa-f]{6}|auto)$",
                      "type": "string"
                    },
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    }
                  },
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ],
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            },
            "left": {
              "oneOf": [
                {
                  "additionalProperties": false,
                  "properties": {
                    "color": {
                      "pattern": "^([0-9A-Fa-f]{6}|auto)$",
                      "type": "string"
                    },
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    }
                  },
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ],
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            },
            "right": {
              "oneOf": [
                {
                  "additionalProperties": false,
                  "properties": {
                    "color": {
                      "pattern": "^([0-9A-Fa-f]{6}|auto)$",
                      "type": "string"
                    },
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    }
                  },
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ],
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            },
            "top": {
              "oneOf": [
                {
                  "additionalProperties": false,
                  "properties": {
                    "color": {
                      "pattern": "^([0-9A-Fa-f]{6}|auto)$",
                      "type": "string"
                    },
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "exclusiveMinimum": 0,
                      "type": "number"
                    }
                  },
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ],
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "type": "object"
        },
        "mode": {
          "const": "edges"
        },
        "nodeId": {
          "type": "string"
        },
        "target": {
          "$ref": "#/$defs/BlockNodeAddress"
        }
      },
      "required": [
        "mode",
        "edges"
      ],
      "type": "object"
    }
  ]
}
{
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "table": {
          "$ref": "#/$defs/TableAddress"
        },
        "trackedChangeRefs": {
          "items": {
            "$ref": "#/$defs/EntityAddress"
          },
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "failure": {
          "additionalProperties": false,
          "properties": {
            "code": {
              "enum": [
                "NO_OP",
                "INVALID_TARGET",
                "TARGET_NOT_FOUND",
                "CAPABILITY_UNAVAILABLE"
              ]
            },
            "details": {},
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object"
        },
        "success": {
          "const": false
        }
      },
      "required": [
        "success",
        "failure"
      ],
      "type": "object"
    }
  ]
}
{
  "additionalProperties": false,
  "properties": {
    "success": {
      "const": true
    },
    "table": {
      "$ref": "#/$defs/TableAddress"
    },
    "trackedChangeRefs": {
      "items": {
        "$ref": "#/$defs/EntityAddress"
      },
      "type": "array"
    }
  },
  "required": [
    "success"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "failure": {
      "additionalProperties": false,
      "properties": {
        "code": {
          "enum": [
            "NO_OP",
            "INVALID_TARGET",
            "TARGET_NOT_FOUND",
            "CAPABILITY_UNAVAILABLE"
          ]
        },
        "details": {},
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "success": {
      "const": false
    }
  },
  "required": [
    "success",
    "failure"
  ],
  "type": "object"
}