Xceed Words for .NET v5.0 Documentation
Welcome to Xceed Words for .NET v5.0 / Code Snippets / Creating a new table and adding it to a document
In This Topic
    Creating a new table and adding it to a document
    In This Topic

    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();
          }
        }