# tables.setBorders

> Set borders on a table using a target set or per-edge patch.



- Member path: `doc.tables.setBorders(…)`
- Mutates document: yes
- Idempotency: `idempotent`
- Supports tracked mode: no
- Supports dry run: yes

## Expected result

Returns a TableMutationResult receipt. Does not perform NO_OP detection.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "BlockNodeAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "block"
        },
        "nodeType": {
          "enum": [
            "paragraph",
            "heading",
            "listItem",
            "table",
            "tableRow",
            "tableCell",
            "tableOfContents",
            "image",
            "sdt"
          ]
        },
        "nodeId": {
          "type": "string"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeType",
        "nodeId"
      ]
    },
    "StoryLocator": {
      "description": "Story scope. Defaults to document body when omitted. Use {kind:'story', storyType:'body'} for body, or other storyType values for headers, footers, footnotes, endnotes.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "body"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "headerFooterSlot"
            },
            "section": {
              "$ref": "#/$defs/SectionAddress"
            },
            "headerFooterKind": {
              "enum": [
                "header",
                "footer"
              ]
            },
            "variant": {
              "enum": [
                "default",
                "first",
                "even"
              ]
            },
            "resolution": {
              "enum": [
                "effective",
                "explicit"
              ]
            },
            "onWrite": {
              "enum": [
                "materializeIfInherited",
                "editResolvedPart",
                "error"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "section",
            "headerFooterKind",
            "variant"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "headerFooterPart"
            },
            "refId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "refId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "footnote"
            },
            "noteId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "noteId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "endnote"
            },
            "noteId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "noteId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "textbox"
            },
            "textboxId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "textboxId"
          ]
        }
      ]
    },
    "SectionAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "section"
        },
        "sectionId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "sectionId"
      ]
    }
  },
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "target": {
          "$ref": "#/$defs/BlockNodeAddress"
        },
        "nodeId": {
          "type": "string"
        },
        "mode": {
          "const": "applyTo"
        },
        "applyTo": {
          "enum": [
            "all",
            "outside",
            "inside",
            "top",
            "bottom",
            "left",
            "right",
            "insideH",
            "insideV"
          ]
        },
        "border": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "lineStyle": {
                  "type": "string"
                },
                "lineWeightPt": {
                  "type": "number",
                  "exclusiveMinimum": 0
                },
                "color": {
                  "type": "string",
                  "pattern": "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$"
                }
              },
              "additionalProperties": false,
              "required": [
                "lineStyle",
                "lineWeightPt",
                "color"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "mode",
        "applyTo",
        "border"
      ],
      "oneOf": [
        {
          "required": [
            "target"
          ]
        },
        {
          "required": [
            "nodeId"
          ]
        }
      ]
    },
    {
      "type": "object",
      "properties": {
        "target": {
          "$ref": "#/$defs/BlockNodeAddress"
        },
        "nodeId": {
          "type": "string"
        },
        "mode": {
          "const": "edges"
        },
        "edges": {
          "type": "object",
          "properties": {
            "top": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "bottom": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "left": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "right": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "insideH": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "insideV": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "lineStyle": {
                      "type": "string"
                    },
                    "lineWeightPt": {
                      "type": "number",
                      "exclusiveMinimum": 0
                    },
                    "color": {
                      "type": "string",
                      "pattern": "^(#?([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})|auto)$"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "lineStyle",
                    "lineWeightPt",
                    "color"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false,
      "required": [
        "mode",
        "edges"
      ],
      "oneOf": [
        {
          "required": [
            "target"
          ]
        },
        {
          "required": [
            "nodeId"
          ]
        }
      ]
    }
  ]
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "TableAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "block"
        },
        "nodeType": {
          "const": "table"
        },
        "nodeId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeType",
        "nodeId"
      ]
    },
    "EntityAddress": {
      "oneOf": [
        {
          "$ref": "#/$defs/CommentAddress"
        },
        {
          "$ref": "#/$defs/TrackedChangeAddress"
        }
      ]
    },
    "CommentAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "entity"
        },
        "entityType": {
          "const": "comment"
        },
        "entityId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "entityType",
        "entityId"
      ]
    },
    "TrackedChangeAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "entity"
        },
        "entityType": {
          "const": "trackedChange"
        },
        "entityId": {
          "type": "string"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "entityType",
        "entityId"
      ]
    },
    "StoryLocator": {
      "description": "Story scope. Defaults to document body when omitted. Use {kind:'story', storyType:'body'} for body, or other storyType values for headers, footers, footnotes, endnotes.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "body"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "headerFooterSlot"
            },
            "section": {
              "$ref": "#/$defs/SectionAddress"
            },
            "headerFooterKind": {
              "enum": [
                "header",
                "footer"
              ]
            },
            "variant": {
              "enum": [
                "default",
                "first",
                "even"
              ]
            },
            "resolution": {
              "enum": [
                "effective",
                "explicit"
              ]
            },
            "onWrite": {
              "enum": [
                "materializeIfInherited",
                "editResolvedPart",
                "error"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "section",
            "headerFooterKind",
            "variant"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "headerFooterPart"
            },
            "refId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "refId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "footnote"
            },
            "noteId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "noteId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "endnote"
            },
            "noteId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "noteId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "textbox"
            },
            "textboxId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "textboxId"
          ]
        }
      ]
    },
    "SectionAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "section"
        },
        "sectionId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "sectionId"
      ]
    }
  },
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "table": {
          "$ref": "#/$defs/TableAddress"
        },
        "trackedChangeRefs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EntityAddress"
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "success"
      ]
    },
    {
      "type": "object",
      "properties": {
        "success": {
          "const": false
        },
        "failure": {
          "type": "object",
          "properties": {
            "code": {
              "enum": [
                "NO_OP",
                "INVALID_TARGET",
                "TARGET_NOT_FOUND",
                "CAPABILITY_UNAVAILABLE"
              ]
            },
            "message": {
              "type": "string"
            },
            "details": {}
          },
          "additionalProperties": false,
          "required": [
            "code",
            "message"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "success",
        "failure"
      ]
    }
  ]
}
```

## Pre-apply throws

- `TARGET_NOT_FOUND`
- `INVALID_TARGET`
- `CAPABILITY_UNAVAILABLE`

## Non-applied receipt codes

- `INVALID_TARGET`
- `INVALID_INPUT`

