> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/create/document-creation-api/tables.md).

# Tables

Use the doc creation API to programmatically create tables.

A `Table` is a grid of cells built row by row. Tables break across pages automatically, and because a `TableCell` is a full content container, cells can hold anything a document can hold.

## Basic table

Create the table with `AddTable`, add rows with `AddTableRow`, and add cells with `AddTableCell`. `SetDefaultColumnWidth` and `SetDefaultRowHeight` provide the grid defaults.

Borders are set at two levels. `Table.SetBorder` draws only the outer frame around the whole table. It doesn't draw the lines between the cells. To get a full grid, call `TableCell.SetBorder` on each cell as well. Both calls take a thickness in points plus an RGB color, and apply it to all four edges.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
Table table = doc.AddTable();
table.SetDefaultColumnWidth(90);
table.SetDefaultRowHeight(18);
table.SetBorder(0.75, 120, 120, 120);

for (int r = 0; r < 3; ++r)
{
    TableRow row = table.AddTableRow();
    for (int c = 0; c < 3; ++c)
    {
        TableCell cell = row.AddTableCell();
        cell.SetBorder(0.75, 120, 120, 120);   // draws the internal grid lines
        cell.AddParagraph("R" + r + " C" + c);
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
Table table = doc.AddTable();
table.SetDefaultColumnWidth(90);
table.SetDefaultRowHeight(18);
table.SetBorder(0.75, 120, 120, 120);

for (int r = 0; r < 3; ++r)
{
    TableRow row = table.AddTableRow();
    for (int c = 0; c < 3; ++c)
    {
        TableCell cell = row.AddTableCell();
        cell.SetBorder(0.75, 120, 120, 120);   // draws the internal grid lines
        cell.AddParagraph("R" + IntToString(r) + " C" + IntToString(c));
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
table := doc.AddTable()
table.SetDefaultColumnWidth(90)
table.SetDefaultRowHeight(18)
table.SetBorder(0.75, 120, 120, 120)

for r := 0; r < 3; r++ {
    row := table.AddTableRow()
    for c := 0; c < 3; c++ {
        cell := row.AddTableCell()
        cell.SetBorder(0.75, 120, 120, 120) // draws the internal grid lines
        cell.AddParagraph(fmt.Sprintf("R%d C%d", r, c))
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
Table table = doc.addTable();
table.setDefaultColumnWidth(90);
table.setDefaultRowHeight(18);
table.setBorder(0.75, 120, 120, 120);

for (int r = 0; r < 3; ++r) {
    TableRow row = table.addTableRow();
    for (int c = 0; c < 3; ++c) {
        TableCell cell = row.addTableCell();
        cell.setBorder(0.75, 120, 120, 120);   // draws the internal grid lines
        cell.addParagraph("R" + r + " C" + c);
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```javascript
const table = await doc.addTable();
table.setDefaultColumnWidth(90);
table.setDefaultRowHeight(18);
table.setBorder(0.75, 120, 120, 120);

for (let r = 0; r < 3; r++) {
    const row = await table.addTableRow();
    for (let c = 0; c < 3; c++) {
        const cell = await row.addTableCell();
        cell.setBorder(0.75, 120, 120, 120);   // draws the internal grid lines
        await cell.addParagraphWithText('R' + r + ' C' + c);
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objectivec
PTTable* table = [doc AddTable];
[table SetDefaultColumnWidth:90];
[table SetDefaultRowHeight:18];
[table SetBorder:0.75 red:120 green:120 blue:120];

for (int r = 0; r < 3; ++r)
{
    PTTableRow* row = [table AddTableRow];
    for (int c = 0; c < 3; ++c)
    {
        PTTableCell* cell = [row AddTableCell];
        // Draws the internal grid lines.
        [cell SetBorder:0.75 red:120 green:120 blue:120];
        [cell AddParagraphWithText:[NSString stringWithFormat:@"R%d C%d", r, c]];
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$table = $doc->AddTable();
$table->SetDefaultColumnWidth(90);
$table->SetDefaultRowHeight(18);
$table->SetBorder(0.75, 120, 120, 120);

for ($r = 0; $r < 3; ++$r) {
    $row = $table->AddTableRow();
    for ($c = 0; $c < 3; ++$c) {
        $cell = $row->AddTableCell();
        $cell->SetBorder(0.75, 120, 120, 120);   // draws the internal grid lines
        $cell->AddParagraph("R".$r." C".$c);
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
table = doc.AddTable()
table.SetDefaultColumnWidth(90)
table.SetDefaultRowHeight(18)
table.SetBorder(0.75, 120, 120, 120)

for r in range(3):
    row = table.AddTableRow()
    for c in range(3):
        cell = row.AddTableCell()
        cell.SetBorder(0.75, 120, 120, 120)   # draws the internal grid lines
        cell.AddParagraph("R%d C%d" % (r, c))
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
table = doc.AddTable()
table.SetDefaultColumnWidth(90)
table.SetDefaultRowHeight(18)
table.SetBorder(0.75, 120, 120, 120)

(0..2).each do |r|
  row = table.AddTableRow()
  (0..2).each do |c|
    cell = row.AddTableCell()
    cell.SetBorder(0.75, 120, 120, 120)   # draws the internal grid lines
    cell.AddParagraph("R#{r} C#{c}")
  end
end
```

{% endcode %}
{% endtab %}
{% endtabs %}

<figure><img src="https://3779731113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fziw3GiL98Xfj63F3He8h%2Fuploads%2FK630wVZHtZW3qdmoon9f%2Ftable_basic.png?alt=media&amp;token=848a63a5-5482-4fc3-a186-ca5a8b448813" alt="An example of borders on a table."><figcaption></figcaption></figure>

The number of columns is determined by the number of cells you add to each row; rows can differ.

## Style cells

Cells carry their own background color, border, alignment, and size. A typical pattern is a colored header row plus alternating row shading.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
TableRow header = table.AddTableRow();
foreach (string text in headers)
{
    TableCell cell = header.AddTableCell();
    cell.SetBackgroundColor(0, 51, 102);
    cell.SetBorder(0.75, 0, 51, 102);
    cell.SetVerticalAlignment(TableCell.CellAlignmentVertical.e_center);

    Paragraph para = cell.AddParagraph(text);
    para.SetStartIndent(3);

    TextStyledElement style = para.GetTextStyledElement();
    style.SetBold(true);
    style.SetTextColor(255, 255, 255);
}
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
TableRow header = table.AddTableRow();
for (int c = 0; c < 3; ++c)
{
    TableCell cell = header.AddTableCell();
    cell.SetBackgroundColor(0, 51, 102);
    cell.SetBorder(0.75, 0, 51, 102);
    cell.SetVerticalAlignment(TableCell::e_alignment_center);

    Paragraph para = cell.AddParagraph(headers[c]);
    para.SetStartIndent(3);

    TextStyledElement style = para.GetTextStyledElement();
    style.SetBold(true);
    style.SetTextColor(255, 255, 255);
}
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
header := table.AddTableRow()
for _, text := range headers {
    cell := header.AddTableCell()
    cell.SetBackgroundColor(0, 51, 102)
    cell.SetBorder(0.75, 0, 51, 102)
    cell.SetVerticalAlignment(TableCellE_alignment_center)

    para := cell.AddParagraph(text)
    para.SetStartIndent(3)

    style := para.GetTextStyledElement()
    style.SetBold(true)
    style.SetTextColor(255, 255, 255)
}
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
TableRow header = table.addTableRow();
for (String text : headers) {
    TableCell cell = header.addTableCell();
    cell.setBackgroundColor(0, 51, 102);
    cell.setBorder(0.75, 0, 51, 102);
    cell.setVerticalAlignment(TableCell.CellAlignmentVerticalVals.e_alignment_center);

    Paragraph para = cell.addParagraph(text);
    para.setStartIndent(3);

    TextStyledElement style = para.getTextStyledElement();
    style.setBold(true);
    style.setTextColor(255, 255, 255);
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```javascript
const header = await table.addTableRow();
for (let c = 0; c < 3; c++) {
    const cell = await header.addTableCell();
    cell.setBackgroundColor(0, 51, 102);
    cell.setBorder(0.75, 0, 51, 102);
    cell.setVerticalAlignment(PDFNet.TableCell.AlignmentVertical.e_alignment_center);

    const para = await cell.addParagraphWithText(headers[c]);
    para.setStartIndent(3);

    const style = await para.getTextStyledElement();
    style.setBold(true);
    style.setTextColor(255, 255, 255);
}
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objectivec
PTTableRow* header = [table AddTableRow];
for (NSString* text in headers)
{
    PTTableCell* cell = [header AddTableCell];
    [cell SetBackgroundColor:0 green:51 blue:102];
    [cell SetBorder:0.75 red:0 green:51 blue:102];
    [cell SetVerticalAlignment:e_ptcell_alignment_center];

    PTParagraph* para = [cell AddParagraphWithText:text];
    [para SetStartIndent:3];

    PTTextStyledElement* style = [para GetTextStyledElement];
    [style SetBold:YES];
    [style SetTextColor:255 green:255 blue:255];
}
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$header = $table->AddTableRow();
foreach ($headers as $text) {
    $cell = $header->AddTableCell();
    $cell->SetBackgroundColor(0, 51, 102);
    $cell->SetBorder(0.75, 0, 51, 102);
    $cell->SetVerticalAlignment(TableCell::e_alignment_center);

    $para = $cell->AddParagraph($text);
    $para->SetStartIndent(3);

    $style = $para->GetTextStyledElement();
    $style->SetBold(true);
    $style->SetTextColor(255, 255, 255);
}
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
header = table.AddTableRow()
for text in headers:
    cell = header.AddTableCell()
    cell.SetBackgroundColor(0, 51, 102)
    cell.SetBorder(0.75, 0, 51, 102)
    cell.SetVerticalAlignment(TableCell.e_alignment_center)

    para = cell.AddParagraph(text)
    para.SetStartIndent(3)

    style = para.GetTextStyledElement()
    style.SetBold(True)
    style.SetTextColor(255, 255, 255)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
header = table.AddTableRow()
headers.each do |text|
  cell = header.AddTableCell()
  cell.SetBackgroundColor(0, 51, 102)
  cell.SetBorder(0.75, 0, 51, 102)
  cell.SetVerticalAlignment(TableCell::E_alignment_center)

  para = cell.AddParagraph(text)
  para.SetStartIndent(3)

  style = para.GetTextStyledElement()
  style.SetBold(true)
  style.SetTextColor(255, 255, 255)
end
```

{% endcode %}
{% endtab %}
{% endtabs %}

<figure><img src="https://3779731113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fziw3GiL98Xfj63F3He8h%2Fuploads%2Fh7UgvLXDuBIO6Fq0C4c4%2Ftable_styled.png?alt=media&amp;token=f875e878-cdf1-46cd-b137-b39d796878d4" alt="An example of a header row with a blue color and white text."><figcaption></figcaption></figure>

Horizontal placement of text has two levels. Paragraph justification places the text within the cell's content area, while the cell's horizontal alignment positions the content block within the cell. A small start indent keeps text off the cell border.

### Alignment values

| Enum                      | Values                                                        |
| ------------------------- | ------------------------------------------------------------- |
| Vertical cell alignment   | `e_alignment_top`, `e_alignment_center`, `e_alignment_bottom` |
| Horizontal cell alignment | `e_alignment_left`, `e_alignment_middle`, `e_alignment_right` |

## Merge cells

`MergeCellsRight` absorbs the next cells in the row, and `MergeCellsDown` absorbs the next cells in the column. Cells are addressed with `GetTableCell`, which takes the column first and then the row.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
table.GetTableCell(0, 0).MergeCellsRight(1);   // span two columns
table.GetTableCell(2, 1).MergeCellsDown(1);    // span two rows
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
table.GetTableCell(0, 0).MergeCellsRight(1);   // span two columns
table.GetTableCell(2, 1).MergeCellsDown(1);    // span two rows
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
table.GetTableCell(0, 0).MergeCellsRight(1)   // span two columns
table.GetTableCell(2, 1).MergeCellsDown(1)    // span two rows
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
table.getTableCell(0, 0).mergeCellsRight(1);   // span two columns
table.getTableCell(2, 1).mergeCellsDown(1);    // span two rows
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```javascript
(await table.getTableCell(0, 0)).mergeCellsRight(1);   // span two columns
(await table.getTableCell(2, 1)).mergeCellsDown(1);    // span two rows
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objectivec
[[table GetTableCell:0 row:0] MergeCellsRight:1];   // span two columns
[[table GetTableCell:2 row:1] MergeCellsDown:1];    // span two rows
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$table->GetTableCell(0, 0)->MergeCellsRight(1);   // span two columns
$table->GetTableCell(2, 1)->MergeCellsDown(1);    // span two rows
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
table.GetTableCell(0, 0).MergeCellsRight(1)   # span two columns
table.GetTableCell(2, 1).MergeCellsDown(1)    # span two rows
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
table.GetTableCell(0, 0).MergeCellsRight(1)   # span two columns
table.GetTableCell(2, 1).MergeCellsDown(1)    # span two rows
```

{% endcode %}
{% endtab %}
{% endtabs %}

<figure><img src="https://3779731113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fziw3GiL98Xfj63F3He8h%2Fuploads%2FQ7JhbabyBz0Hi0uCUZ4F%2Ftable_merged_cells.png?alt=media&amp;token=72851fc0-9b1d-47ac-93d1-822325f54623" alt="An example of merged cells in a table."><figcaption></figcaption></figure>

Merging is how invoice-style totals blocks are built: add a full-width row, then merge away the leading empty cells so the label sits next to the amount. After merging, a row reports fewer columns.

## Nest content in cells

`TableCell` is a content container, so paragraphs, lists, and tables are all available inside a cell.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
TableRow row = table.AddTableRow();

TableCell left = row.AddTableCell();
left.SetBorder(0.75, 120, 120, 120);
left.AddParagraph("Checklist:");

List list = left.AddList();
list.SetNumberFormat(List.NumberFormat.e_decimal, ".", true);
list.AddItem().AddParagraph("Draft");
list.AddItem().AddParagraph("Review");

TableCell right = row.AddTableCell();
right.SetBackgroundColor(240, 244, 248);
right.SetBorder(0.75, 120, 120, 120);
right.SetVerticalAlignment(TableCell.CellAlignmentVertical.e_center);
right.AddParagraph("Cells can be shaded and vertically aligned.");
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
TableRow row = table.AddTableRow();

TableCell left = row.AddTableCell();
left.SetBorder(0.75, 120, 120, 120);
left.AddParagraph("Checklist:");

List list = left.AddList();
list.SetNumberFormat(List::e_decimal, ".", true);
list.AddItem().AddParagraph("Draft");
list.AddItem().AddParagraph("Review");

TableCell right = row.AddTableCell();
right.SetBackgroundColor(240, 244, 248);
right.SetBorder(0.75, 120, 120, 120);
right.SetVerticalAlignment(TableCell::e_alignment_center);
right.AddParagraph("Cells can be shaded and vertically aligned.");
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
row := table.AddTableRow()

left := row.AddTableCell()
left.SetBorder(0.75, 120, 120, 120)
left.AddParagraph("Checklist:")

list := left.AddList()
list.SetNumberFormat(ListE_decimal, ".", true)
list.AddItem().AddParagraph("Draft")
list.AddItem().AddParagraph("Review")

right := row.AddTableCell()
right.SetBackgroundColor(240, 244, 248)
right.SetBorder(0.75, 120, 120, 120)
right.SetVerticalAlignment(TableCellE_alignment_center)
right.AddParagraph("Cells can be shaded and vertically aligned.")
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
TableRow row = table.addTableRow();

TableCell left = row.addTableCell();
left.setBorder(0.75, 120, 120, 120);
left.addParagraph("Checklist:");

List list = left.addList();
list.setNumberFormat(List.ListItemNumberFormat.e_decimal, ".", true);
list.addItem().addParagraph("Draft");
list.addItem().addParagraph("Review");

TableCell right = row.addTableCell();
right.setBackgroundColor(240, 244, 248);
right.setBorder(0.75, 120, 120, 120);
right.setVerticalAlignment(TableCell.CellAlignmentVerticalVals.e_alignment_center);
right.addParagraph("Cells can be shaded and vertically aligned.");
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```javascript
const row = await table.addTableRow();

const left = await row.addTableCell();
left.setBorder(0.75, 120, 120, 120);
await left.addParagraphWithText('Checklist:');

const list = await left.addList();
list.setNumberFormat(PDFNet.List.NumberFormat.e_decimal, '.', true);
await (await list.addItem()).addParagraphWithText('Draft');
await (await list.addItem()).addParagraphWithText('Review');

const right = await row.addTableCell();
right.setBackgroundColor(240, 244, 248);
right.setBorder(0.75, 120, 120, 120);
right.setVerticalAlignment(PDFNet.TableCell.AlignmentVertical.e_alignment_center);
await right.addParagraphWithText('Cells can be shaded and vertically aligned.');
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objectivec
PTTableRow* row = [table AddTableRow];

PTTableCell* left = [row AddTableCell];
[left SetBorder:0.75 red:120 green:120 blue:120];
[left AddParagraphWithText:@"Checklist:"];

PTList* list = [left AddList];
[list SetNumberFormatWithSuffix:e_ptlist_format_decimal suffix:@"." cascade:YES];
[[list AddItem] AddParagraphWithText:@"Draft"];
[[list AddItem] AddParagraphWithText:@"Review"];

PTTableCell* right = [row AddTableCell];
[right SetBackgroundColor:240 green:244 blue:248];
[right SetBorder:0.75 red:120 green:120 blue:120];
[right SetVerticalAlignment:e_ptcell_alignment_center];
[right AddParagraphWithText:@"Cells can be shaded and vertically aligned."];
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$row = $table->AddTableRow();

$left = $row->AddTableCell();
$left->SetBorder(0.75, 120, 120, 120);
$left->AddParagraph("Checklist:");

$list = $left->AddList();
$list->SetNumberFormat(ListContainer::e_decimal, ".", true);
$list->AddItem()->AddParagraph("Draft");
$list->AddItem()->AddParagraph("Review");

$right = $row->AddTableCell();
$right->SetBackgroundColor(240, 244, 248);
$right->SetBorder(0.75, 120, 120, 120);
$right->SetVerticalAlignment(TableCell::e_alignment_center);
$right->AddParagraph("Cells can be shaded and vertically aligned.");
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
row = table.AddTableRow()

left = row.AddTableCell()
left.SetBorder(0.75, 120, 120, 120)
left.AddParagraph("Checklist:")

list = left.AddList()
list.SetNumberFormat(List.e_decimal, ".", True)
list.AddItem().AddParagraph("Draft")
list.AddItem().AddParagraph("Review")

right = row.AddTableCell()
right.SetBackgroundColor(240, 244, 248)
right.SetBorder(0.75, 120, 120, 120)
right.SetVerticalAlignment(TableCell.e_alignment_center)
right.AddParagraph("Cells can be shaded and vertically aligned.")
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
row = table.AddTableRow()

left = row.AddTableCell()
left.SetBorder(0.75, 120, 120, 120)
left.AddParagraph("Checklist:")

list = left.AddList()
list.SetNumberFormat(List::E_decimal, ".", true)
list.AddItem().AddParagraph("Draft")
list.AddItem().AddParagraph("Review")

right = row.AddTableCell()
right.SetBackgroundColor(240, 244, 248)
right.SetBorder(0.75, 120, 120, 120)
right.SetVerticalAlignment(TableCell::E_alignment_center)
right.AddParagraph("Cells can be shaded and vertically aligned.")
```

{% endcode %}
{% endtab %}
{% endtabs %}

<figure><img src="https://3779731113-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fziw3GiL98Xfj63F3He8h%2Fuploads%2FTs40fWuFtIDRIEJvJD6P%2Ftable_nested_content.png?alt=media&amp;token=13887695-55e7-45da-9ab3-2b950711b08d" alt="An example of a numbered list and a paragraph inside of two different table cells."><figcaption></figcaption></figure>

## Sizing values

| Level | Members                                        |
| ----- | ---------------------------------------------- |
| Table | `SetDefaultColumnWidth`, `SetDefaultRowHeight` |
| Row   | `SetRowHeight`                                 |
| Cell  | `SetWidth`, `SetHeight`                        |

More specific settings win: a cell width overrides the table default, and a row height overrides the table default. Row height behaves as a minimum. A row grows when its content needs more space.

## Border values

| Level | Member      | Draws                             |
| ----- | ----------- | --------------------------------- |
| Table | `SetBorder` | The outer frame of the table only |
| Cell  | `SetBorder` | All four edges of that one cell   |

Because the table-level border covers only the outside, the internal grid lines come from the cells. Applying a border to every cell also draws the outer edges, so a cell-level border alone is enough for a uniform grid. Adjacent cell borders share a line, so neighboring cells with different border colors give the shared edge to whichever cell is drawn last.

## Further Reading

* [Paragraphs and text](/core/create/document-creation-api/paragraphs-and-text.md) for tab stops, a lighter alternative for simple column layouts.
* [Traversing the content tree](/core/create/document-creation-api/traverse-the-content-tree.md) for restyling table cells after they have been generated.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/create/document-creation-api/tables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
