SetTableBorderAll
Specifies a border which will be displayed on all table cell borders.
Syntax
expression.SetTableBorderAll(type, size, space, color);
expression - A variable that represents an ApiTablePr class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| type | Required | BorderType | The border style. | |
| size | Required | pt_8 | The width of the current border measured in eighths of a point. | |
| space | Required | pt | The spacing offset in the table cells measured in points used to place this border. | |
| color | Required | ApiColor | The border color. |
Returns
boolean
Example
Apply a uniform border around and inside every edge of a table in a document.
// How do I add borders to all sides of every cell in a table in a document?
// Draw consistent lines along all internal and external table edges in a document.
const doc = Api.GetDocument();
const paragraph = doc.GetElement(0);
paragraph.AddText("We create a 3x3 table and add 4 point black border for the entrire table:");
const tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
const tablePr = tableStyle.GetTablePr();
const table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
tablePr.SetTableBorderAll("single", 32, 0, Api.Color(51, 51, 51));
table.SetTableLook(true, true, true, true, false, false);
table.SetStyle(tableStyle);
doc.Push(table);