Xceed Words for .NET v3.0 Documentation
Creating a new table and adding it to a document
Welcome to Xceed Words for .NET v3.0 > Code Snippets > Creating a new table and adding it to a document

The following example demonstrates how to create a new Table and adding it to a Document.

C#
Copy Code
    private void TablesAndCells( string file )
    {
      using( var document = DocX.Load( file ) )
      {
        // Create a table (initial size of 3 rows and 2 columns).
        var t = document.AddTable( 3, 2 );
        t.Design = TableDesign.TableGrid;

        // Add the table to the document
        document.InsertTable( t );

        // Save the changes to the document
        document.Save();
      }
    }