Add Table
using IronWord;
using IronWord.Models;

// Create table
Table table = new Table(5, 3);

// Apply styling
table.Zebra = new ZebraColor("FFFFFF", "dddddd");

// Populate table
table[0, 0] = new TableCell(new TextContent("Number"));
table[0, 1] = new TableCell(new TextContent("First Name"));
table[0, 2] = new TableCell(new TextContent("Last Name"));
for (int i = 1; i < table.Rows.Count; i++)
{
    table[i, 0].AddChild(new TextContent($"{i}"));
    table[i, 1].AddChild(new TextContent($"---"));
    table[i, 2].AddChild(new TextContent($"---"));
}

// Create new Word document from the table
WordDocument doc = new WordDocument(table);

// Export Word document
doc.SaveAs("Document.docx");
NuGet Download
PM > Install-Package IronWord
Add Table

Add Table

A table is a grid of cells arranged in rows and columns. It's a fundamental feature that allows you to organize and present information in a structured manner. Each intersection of a row and a column in a table is referred to as a cell. Tables are commonly used for various purposes, such as creating schedules, organizing data, and aligning content neatly.

To add a table using IronWord, first instantiate a table by providing the number of rows and columns. Customize the entire table styling to your requirements. Access each cell of the table with the [row, column] format. With this, you can style each cell accordingly and add multiple document elements such as Run, paragraph, image, and shape to the cell. Once the table object has been set up properly, it can be used to create a new Word document.

Learn How to Add Tables in Word with IronWord
View on GitHub

Ready to Get Started?

Nuget Downloads 61,140Version:2026.11just released