Hello Support,
Is there any way to find the list of fields between a table start and a table end?
Is there any way to find the list of fields beween a nested table start and nested table end?
Thanks,
ValuePRO
Hi
Piers,
Thanks for your inquiry. I think, for this you can try something like the following code snippet:
Document
doc = new Document(@“c:\temp\in.docx”);
ArrayList
list = new ArrayList();
NodeCollection fields = doc.GetChildNodes(NodeType.FieldStart,
true);
Node
tableStart = null;
Node
tableEnd = null;
foreach (FieldStart field in
fields)
{
if (((Run)field.NextSibling).Text.Contains("TableStart:MyTable "))
tableStart = field;
if (((Run)field.NextSibling).Text.Contains("TableEnd:MyTable "))
tableEnd = field;
}
int
tableStartIndex = fields.IndexOf(tableStart);
int
tableEndIndex = fields.IndexOf(tableEnd);
for (int i = tableStartIndex + 1; i < tableEndIndex;
i++)
list.Add(fields[i]);
I hope, this will help.
Best Regards,