Extract text from first cell of first row from multiple tables

I have a word document with multiple tables.
From those tables I need to extract the text from the first cell of the first row(so top left text of every table) and add it into a list. I have tried doing this but I can’t get it to work.

I hope someone can help me with this.

I have uploaded the file I am using here aswell. Testcases - documentatie.zip (25.8 KB)

@kits,

You can build logic on the following C# code of Aspose.Words for .NET API to extract Text representations of first Cells of first Rows of all Tables in Word document:

Document doc = new Document("C:\\Temp\\Testcases - documentatie\\5- Testcases - documentatie.docx");

ArrayList textsOfTables = new ArrayList();
foreach (Table table in doc.GetChildNodes(NodeType.Table, true))
    textsOfTables.Add(table.FirstRow.FirstCell.ToString(SaveFormat.Text));

// Lets write extracted text of tables into a new document
DocumentBuilder builder = new DocumentBuilder();

foreach (string str in textsOfTables)
{
    builder.Writeln(str);
    builder.InsertBreak(BreakType.SectionBreakNewPage);
}

builder.Document.Save("C:\\temp\\Testcases - documentatie\\21.1.docx");

Thank you for your help, this does kind of work. But for some reason it won’t get more than three tables from the document. this also happend when I was trying.

@kits,

The problem simply occurs because you seem to be using Aspose.Words for .NET in evaluation mode (i.e. without applying a license). If you want to test ‘Aspose.Words for .NET’ without the evaluation version limitations, then you can also request a 30-day Temporary License. Please refer to How to get a Temporary License?