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

Free Support Forum - aspose.com

Running .GetText() on a Row (from table) output is inconsistent

I have an empty table (about twenty rows and 5 columns). I want to insert a new row in the middle (roughly), with the first column having some text and then the other four having simple html (i.e one word colored blue in p tags), and then I want to print the .GetText() of the whole row after each cell have been changed.

I’ve attached the code that I am running.


Hi Rob,

Thanks for your inquiry. Please use Node.ToString(SaveFormat.Text) method to export the content of the node into text. Please use the following code example to get the desired output. Hope this helps you.

var doc = new Document(MyDir + "RowGetTextIssue.docx");
var builder = new DocumentBuilder(doc);
Aspose.Words.Tables.Table table = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 0, true);
var newRow = (Aspose.Words.Tables.Row)table.LastRow.Clone(true);
int insertLoc = (table.Rows.Count - 1) / 2;
table.Rows.Insert(insertLoc, newRow);
int i = 0;
foreach (Aspose.Words.Tables.Cell cell in newRow.Cells)
    if (++i == 1)
        Aspose.Words.Run run = new Aspose.Words.Run(doc, "Row Header");
    var para = new Aspose.Words.Paragraph(doc);
    builder.InsertHtml("<b>Bold text..: " + i + "</b>");