New to Telerik Document ProcessingStart a free 30-day trial

RadPdfProcessing Table Overview

Updated on Jul 15, 2026

Use the Table class to generate tabular content in PDF documents with RadPdfProcessing. You define rows, cells, styling, and layout settings, and then pass the table to FixedContentEditor or RadFixedDocumentEditor to measure, position, draw, and split it across pages.

This overview explains the table building blocks, the main layout properties, and the different ways to insert or draw a table so you can choose the right workflow for your document scenario.

RadPdfProcessing table model diagram showing rows and cells

Each table contains a series of TableRow instances each of which contains a series of TableCell instances. To define a simple table, generate the table cells and add some content to them.

Use this article when you need to:

  • Create a PDF table from code.
  • Apply shared styling to table cells.
  • Control layout behavior such as width, spacing, and border collapse.
  • Insert a table into a document by using RadFixedDocumentEditor.
  • Draw a table with FixedContentEditor when you need extra placement control.
  • Measure a table before you render it.

If you are new to the document editors, start with the editor choice in this article and then continue to the linked editor documentation for API details.

Defining Table Content

Each Table contains a collection of TableRow instances, and each row contains a collection of TableCell instances. To create a table, add the required cells and then assign content to each cell.

  1. Create a Table instance.
  2. Add rows and cells.
  3. Put content in each cell.
  4. Apply layout and styling properties.
  5. Insert or draw the table with the appropriate editor.

The following snippet creates a table with two rows and three columns and fills each cell with sample text.

Create a Simple Table

C#
Table table = new Table();

TableRow firstRow = table.Rows.AddTableRow();
firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell11");
firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell12");
firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell13");

TableRow secondRow = table.Rows.AddTableRow();
secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell21");
secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell22");
secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell23");

The result is shown in the following image.

Table

RadPdfProcessing simple table with two rows and three columns

Using DefaultCellProperties

Use the table DefaultCellProperties property when the same styling should apply to every cell. This reduces repetitive cell-by-cell configuration and gives you a consistent base style for the whole table.

The most common default cell properties are:

PropertyDescription
PaddingSpecifies the distances between the inner cell border contour and the cell content.
BordersOf type TableCellBorders. Specifies the borders of a single cell. The available borders are left, right, top, bottom, diagonal up, and diagonal down.
BackgroundSpecifies the background of the cell.

The following snippet shows how to use the DefaultCellProperties of a table.

Use DefaultCellProperties on a Table

C#
Table table = new Table();
Border redBorder = new Border(2, new RgbColor(255, 0, 0));
table.DefaultCellProperties.Borders = new TableCellBorders(redBorder);
table.DefaultCellProperties.Padding = new Thickness(20, 10, 20, 10);
table.DefaultCellProperties.Background = new RgbColor(0, 255, 0);

TableRow firstRow = table.Rows.AddTableRow();
firstRow.Cells.AddTableCell();
firstRow.Cells.AddTableCell();
firstRow.Cells.AddTableCell();

TableRow secondRow = table.Rows.AddTableRow();
secondRow.Cells.AddTableCell();
secondRow.Cells.AddTableCell();
secondRow.Cells.AddTableCell();

The result of the snippet is demonstrated in the following image.

Result of DefaultCellProperties modification RadPdfProcessing table with modified default cell properties

Modifying a Table

Several table properties affect measurement, spacing, and rendering behavior:

  • Margin: Specifies the distances between the table borders outline and the rest of the document content.

  • Padding: Set through the TableCell Padding property, it specifies the distances between cell borders inner contour and the cell content.

  • LayoutType: Specifies the algorithm used to layout table contents. Two options are available in the TableLayoutType enumeration:

    • AutoFit – The table width fits the content unless the needed width is bigger than the available measuring width.
    • FixedWidth – The table width always fits the available measuring width.
  • HorizontalAlignment: Specifies the alignment of the table inside the page.

  • BorderSpacing: Specifies the distance between all the borders in the table. This distance is measured differently depending on the BorderCollapse option.

  • BorderCollapse: Specifies the way the border spacing calculations are done. Two options are available:

    • Collapse: The distance between borders is measured from the middle lines of the borders.
    • Separate: The distance between borders is measured from the outer border contour.

The following snippets show how border calculations change when you switch the BorderCollapse option. The first snippet creates an empty table and applies default cell padding and a red table border with thickness 10.

Create a Table with a Red Border

C#
Table table = new Table();
table.DefaultCellProperties.Padding = new Thickness(10, 6, 10, 6);
Border redBorder = new Border(10, new RgbColor(255, 0, 0));
table.Borders = new TableBorders(redBorder);

The next snippet adds a single row with two cells to the table from the previous example. The first cell has a green border with thickness 5, and the second cell has a blue border with thickness 3.

Add Green and Blue Cells

C#
TableRow tableRow = table.Rows.AddTableRow();

TableCell firstCell = tableRow.Cells.AddTableCell();
Border greenBorder = new Border(5, new RgbColor(0, 255, 0));
firstCell.Borders = new TableCellBorders(greenBorder, greenBorder, greenBorder, greenBorder);
firstCell.Blocks.AddBlock().InsertText("green bordered cell");

TableCell secondCell = tableRow.Cells.AddTableCell();
Border blueBorder = new Border(3, new RgbColor(0, 0, 255));
secondCell.Borders = new TableCellBorders(blueBorder, blueBorder, blueBorder, blueBorder);
secondCell.Blocks.AddBlock().InsertText("blue bordered cell");

The following image shows the table with the BorderCollapse property set to Collapse. All borders are drawn so that their middle lines coincide.

Collapse Borders

C#
table.BorderCollapse = BorderCollapse.Collapse;

Collapsed border

RadPdfProcessing table with collapsed borders

The following image shows the same table with BorderCollapse set to Separate, so the outer border contours coincide.

Separate Borders

C#
table.BorderCollapse = BorderCollapse.Separate;

Separated border RadPdfProcessing table with separated borders

Drawing Table with RadFixedDocumentEditor

Use RadFixedDocumentEditor.InsertTable() when you want the editor to place the table in the document flow and split it across pages when needed. This is the easier option for standard document-generation scenarios.

The following snippet creates a simple table with two cells.

Create a Table

C#
Table table = new Table();

Border border = new Border();
table.Borders = new TableBorders(border);
table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border);

table.BorderSpacing = 5;
table.BorderCollapse = BorderCollapse.Separate;

TableRow row = table.Rows.AddTableRow();
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("First cell");
row.Cells.AddTableCell().Blocks.AddBlock().InsertText("Second cell");

The following snippet inserts the table in a RadFixedDocumentEditor and specifies the table layout type to AutoFit.

Insert AutoFit table

C#
using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
{
    table.LayoutType = TableLayoutType.AutoFit;
    editor.InsertTable(table);
}

The result is that the table width is exactly as needed for fitting the cell content, as visible in the following image.

AutoFit table

RadPdfProcessing AutoFit table sized to its cell content

Using FixedWidth produces different results because the editor fits the table to the available measuring width.

Insert a FixedWidth Table

C#
using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
{
    table.LayoutType = TableLayoutType.FixedWidth;
    editor.InsertTable(table);
}

FixedWidth table

RadPdfProcessing FixedWidth table stretched to the available width

Drawing Table with FixedContentEditor

Use FixedContentEditor.DrawTable() when you need lower-level drawing control, such as custom positioning, transforms, or rotation.

The following snippet draws a rotated table with FixedContentEditor.

Draw a Rotated Table

C#
Table table = new Table();

TableRow firstRow = table.Rows.AddTableRow();
firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell11");
firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell12");
firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell13");

TableRow secondRow = table.Rows.AddTableRow();
secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell21");
secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell22");
secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("cell23");

RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage();
FixedContentEditor editor = new FixedContentEditor(page, new SimplePosition());

editor.Position.Translate(10, 100);
editor.Position.Rotate(-45);
editor.DrawTable(table);

The following image shows a 45-degree rotated table similar to the AutoFit example.

Rotated table

RadPdfProcessing rotated table drawn with FixedContentEditor

Measuring a Table

The Table class exposes Measure overloads that calculate and return the desired size of the table without drawing it. This is useful when you need to know the table dimensions before inserting it into a document, for example when you must decide whether to use a new page or position other content relative to the table.

Use one of these overloads:

  • Measure(CancellationToken): Measures the table against an infinite available size and returns the resulting Size.
  • Measure(Size, CancellationToken): Measures the table against a constrained available size when the table must fit within a known width or height.

The following snippet demonstrates both measurement approaches.

Measure a Table

C#
Table table = new Table();
TableRow row = table.Rows.AddTableRow();
TableCell cell = row.Cells.AddTableCell();
cell.Blocks.AddBlock().InsertText("Sample content");

// Measure against an infinite available size.
Size measuredSize = table.Measure(CancellationToken.None);

// Obsolete since Q2 2026
// Size measuredSize = table.Measure();

// Measure against a constrained available size.
Size availableSize = new Size(500, 800);
Size constrainedSize = table.Measure(availableSize, CancellationToken.None);

Supported Border Styles

Starting with Q3 2024, RadPdfProcessing supports the Dotted, Dashed, and DashSmallGap border styles in addition to BorderStyle.Single. Starting with the same release, Dotted, Dashed, DashSmallGap, and Thick border lines are also exported from RadFlowDocument to RadFixedDocument.

BorderStyleBorder design
SingleRadPdfProcessing RadPdfProcessing Table Overview Preview of a single-line PDF table border
DottedRadPdfProcessing RadPdfProcessing Table Overview Preview of a dotted PDF table border
DashedRadPdfProcessing RadPdfProcessing Table Overview Preview of a dashed PDF table border
DashSmallGapRadPdfProcessing RadPdfProcessing Table Overview Preview of a dash-small-gap PDF table border

Next Steps

Continue with the article that matches your next task:

See Also