This project has moved and is read-only. For the latest updates, please go here.

InsertRow an InsertColumn exception with empty table ?!!!

Jan 20, 2011 at 2:30 PM

Hello, I've just created an empty table like this:
Table t = document.InsertTable(0,0); (i try eventually with 2,2 without success)

and I would add columns and rows dynamically but there's always an exception throwing... ???
Why ?
Must I always create a fixed table at the start ???

Thanks for your answer in advance...

Jan 29, 2011 at 2:34 PM
Hi PatBir,

the below code example works fine for me, can you please verify that it work for you also? Please download the latest source code before running the below example.

Kind regards,

using (DocX document = DocX.Create("Tables.docx"))
// Add a Table to a document.
Table t = document.AddTable(2, 2);
t.Design = TableDesign.TableGrid;

// Insert the Table into the main section of the document.
Table t1 = document.InsertTable(t);

// Save the document.