This documentation is archived and is not being maintained.

How to: Add Rows and Columns to Word Tables


Some code examples in this topic use the this or Me keyword or the Globals class in a way that is specific to document-level customizations, or they rely on features of document-level customizations such as host controls. These examples can be compiled only if you have the required applications installed. For more information, see Features Available by Product Combination.

In a Microsoft Office Word 2003 table, the cells are organized into rows and columns. You can use the Add method of the Rows object to add rows to the table and the Add method of the Columns object to add columns.

To add a row to a table

  • Use the Add method to add a row to the table.

    object beforeRow = this.Tables[1].Rows[1];
    this.Tables[1].Rows.Add(ref beforeRow);

To add a column to a table

  • Use the Add method, and then use the DistributeWidth method to make all the columns the same width.

    object beforeColumn = this.Tables[1].Columns[1]; 
    this.Tables[1].Columns.Add(ref beforeColumn); 

See Also