This project has moved. For the latest updates, please go here.

Splitting a cell within a table

Jun 1, 2016 at 3:35 PM
I have a table which usually has 2 columns but under some circumstances 1 row requires 3 cells. Originally I made the table 3 cells wide and then merged all of the rows for columns 1 and 2 but that gave some odd results as I ended up with a blank line after the text in the merged cell even though there was nothing in the cell itself.

So anyhow I thought it would be better to stick with a 2 column table and then split the second cell into 2 IF I needed to on a specific row. I did this using

if (table.Rows[0].Cells.Count == 2)
table.Rows[0].Cells.Add(null);
Cell notescell = table.Rows[0].Cells[2];

...but this crashes saying the index 2 is out of range and looking at the row, even after the call to add a cell there are still only 2 cells. So my question is, is there a way to split a cell into 2 within DocX or will I need to think of another method?