We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose word existing table clone row appending with cell values throwing error

HI Team ,

Hope your doing good ,

I am facing the issue clone the row from existing table word doc and appending a row with cell values and There is issue that appending cloning row cell value null or empty than while writing the or set value to that cell it saying that firstchild is null.

((Aspose.Words.Run)row.Cells[3].FirstParagraph.FirstChild).Text = null when the clone row of that cell 3 empty and while traying to set cell to that cell throwing error.
cloned the following first row of table and append to table while assignee a value to Cell 3 above code throwing error like firstchild is null .

Empid EmpName City State Email
1 Testing Banagalore abc@gmail

Pls help us above

Thanks
Sreeni

@sreeni379 It is not necessary that paragraph has child nodes and the the first child node is Run. Most likely in your case cell is empty and it contains only one empty paragraph (without child nodes). If you need to set new text in cell, you can use code like this:

// Remove old content 
row.Cells[3].FirstParagraph.RemoveAllChildren();
// Set new content
row.Cells[3].FirstParagraph.AppendChild(new Run(doc, "this is new text of cell"));