Closed ChrisBellBO closed 2 months ago
I am not sure I understand your question. Each Table has Cells/Rows and so on. Same with nested tables?
Oh, i get it. You want to know which cell has nested table. Hrmms
Yes, that's it
I guess you would need add new property in Cell to include something. This is in the Table itself
public bool HasNestedTables {
get {
foreach (var cell in this.Cells) {
var list = cell._tableCell.Descendants<Table>().ToList();
if (list.Count > 0) {
return true;
}
}
return false;
}
}
public List<WordTable> NestedTables {
get {
var listReturn = new List<WordTable>();
foreach (var cell in this.Cells) {
var list = cell._tableCell.Descendants<Table>().ToList();
foreach (var table in list) {
listReturn.Add(new WordTable(this._document, table));
}
}
return listReturn;
}
}
So as part of specific Cell, just adjust the logic to it can be per Cell as well.
Looks good, I will give it a go, thanks
Hi I'm trying to figure out how nested tables work. I have a Word document with a table containing two nested tables. I can see WordTable has a NestedTables property which contains the two tables but I can't find a way to get the parent cell for each nested table, am I missing something?