How to fine nested tables

Hi,

while going through the document, how to identify a table with nested tables.

Thanks,
Raviteja

Hi
Thanks for your inquiry. Table is nested if TableStart & TableEnd tags is placed between other TableStart & TableEnd. For example:
«TableStart:table1»
………………………….
«TableStart:table2»
………………………….
«TableEnd:table2»
………………………….
«TableEnd:table1»
table2 is nested.
Best regards.

My question is that, how to identify that a document contains nested tables thourgh C# code.

You can try using the following code.

Document doc = new Document(@"401_105291_raviteja\in1.doc");
bool hasNested = false;
string[] names = doc.MailMerge.GetFieldNames();
string currentTable = string.Empty;
for (int i = 0; i < names.Length; i++)
{
    if (names[i].ToLower().StartsWith("tablestart:") && !String.IsNullOrEmpty(currentTable))
    {
        hasNested = true;
        break;
    }
    if (names[i].ToLower().StartsWith("tablestart:") && String.IsNullOrEmpty(currentTable))
    {
        currentTable = names[i].ToLower().Replace("tablestart:", "");
    }
    if (names[i].ToLower().StartsWith("tableend:") && names[i].ToLower().EndsWith(currentTable))
    {
        currentTable = string.Empty;
    }
}

I hope that this will help you.
Best regards.

The issues you have found earlier (filed as 39) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(46)