Xceed Words for .NET v3.0 Documentation
Adding rows and columns to an existing table
Welcome to Xceed Words for .NET v3.0 > Code Snippets > Adding rows and columns to an existing table

The following example demonstrates how to add rows and columns to an existing Table.

C#
Copy Code
    private void TablesAndCells( string file, int tableIndex )

    {

      using( var document = DocX.Load( file ) )

      {

        // Get the table to modify

        var table = document.Tables[ tableIndex ];



        // Add a new column at the end

        table.InsertColumn();



        // Add a new row at the end

        table.InsertRow();



        // Save the changes to the document

        document.Save();

      }

    }

 

The InsertRow and InsertColumn methods have a few overloads, see their documentation for more details