Class TableBorders
Represents the borders of a table element.
Inheritance
Namespace: IronWord.Models
Assembly: IronWord.dll
Syntax
public class TableBorders : Object
When a table needs lines drawn around and between its cells, TableBorders collects the six edges that define them. It groups the outer frame and the inner grid lines into one object you assign to a table, so you set every border in a single place instead of per cell. Reach for it whenever a Word table needs anything beyond the default look.
Each side is its own BorderStyle: TopBorder, BottomBorder, LeftBorder, and RightBorder draw the outer frame, while InsideHorizontalBorder and InsideVerticalBorder draw the grid lines that separate rows and columns inside the table. A BorderStyle carries the color, line pattern, and thickness, so assigning the same instance to several edges keeps them visually matched, and assigning different ones lets the frame differ from the interior.
Build a TableBorders, set the edges you care about, and assign it to the Borders property of a Table or a TableStyle. Edges you leave unset fall back to the table's defaults, so a header rule or a single outer frame needs only the relevant properties populated. Because the same object holds all six sides, a developer can define one border scheme and reuse it across tables for a consistent document. A common scheme gives the outer frame a heavier line and the inside grid a lighter one, which separates the table from the page while keeping the cells legible. Sharing a single BorderStyle instance between matching edges is the simplest way to guarantee those edges stay identical as the design changes.
using IronWord.Models;
Table table = new Table(4, 4);
table.Borders = new TableBorders
{
TopBorder = new BorderStyle(),
BottomBorder = new BorderStyle()
};The add a table how-to shows borders applied to a styled table, the add table example saves a bordered grid to DOCX, and the document element tutorial covers how tables and their styling fit the document model.
Constructors
TableBorders()
Initializes a new instance of the TableBorders class.
Declaration
public TableBorders()
Properties
BottomBorder
Gets or sets the style of the bottom border.
Declaration
public BorderStyle BottomBorder { get; set; }
Property Value
| Type | Description |
|---|---|
| BorderStyle |
InsideHorizontalBorder
Gets or sets the style of the inside horizontal border (between rows).
Declaration
public BorderStyle InsideHorizontalBorder { get; set; }
Property Value
| Type | Description |
|---|---|
| BorderStyle |
InsideVerticalBorder
Gets or sets the style of the inside vertical border (between columns).
Declaration
public BorderStyle InsideVerticalBorder { get; set; }
Property Value
| Type | Description |
|---|---|
| BorderStyle |
LeftBorder
Gets or sets the style of the left border.
Declaration
public BorderStyle LeftBorder { get; set; }
Property Value
| Type | Description |
|---|---|
| BorderStyle |
RightBorder
Gets or sets the style of the right border.
Declaration
public BorderStyle RightBorder { get; set; }
Property Value
| Type | Description |
|---|---|
| BorderStyle |
TopBorder
Gets or sets the style of the top border.
Declaration
public BorderStyle TopBorder { get; set; }
Property Value
| Type | Description |
|---|---|
| BorderStyle |