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

Free Support Forum - aspose.com

Determining the nested table hierarchy within a word merge document

What would be the best method to determine the nested hierarchy? Would you be able to provide an example snippet for this task? Is it possible to parse from mergeDoc.MailMerge.GetFieldNames()? Is GetFieldNames() guaranteed to be ordered?

Thank you in advance for any help you can provide.

Hi Don,

Please check How to use nested mail merge with regions topic for more details and feel free to contact us in case you see any issue.

Best Regards,

Thank you very much for your reply and that article. It is an article I’d read in the past I reviewed it again.

From my understanding the article deals with how to correctly create nested hierarchies in a word document and the basics of how to execute a merge with regions. We have many great working examples of these concepts in our current production code library. Made possible by this great article and others by your team.

However, what I’m hoping to do currently is apply logic at run time based on the observed nested merge table hierarchy that is present in an already correctly created word document. In other words I need to read an existing hierarchy in such a way that I can observe the parent child relationships for a merge with regions in the word document . Does that help clarify the questions above? Would this be something you’d be able to assist me with?

(I don’t think any existing materials cover this question based on my searching)

Don Robinson

Hi Don,

Sorry for the confusion. You can use GetFieldNames method in this case. It will give the field names in the same hierarchy as they appear in the document structure.

Best Regards,

Hey Muhammad,

Thank you for your reply.

Might it be possible to get slightly more detailed answer? Maybe a staff member with some c# .Net experience would be able to address the original questions more thoroughly? Perhaps some basic example code?

Hi Don,

It would be great if you can attach a sample document and the expected output after running your desired code. This will help us prepare correct example. Sorry for the inconvenience.

Best Regards,

Sounds like a reasonable next step. No inconvenience. I’ll see what I can put together.

I realized that part of the problem is a lack of support for data hierarchies in .Net.

So I’d suggest this should be the best data structure to hold the output for a simple example

public struct Node {
String TableName;
List childern;

List TopLevelTables;

TopLevelTables[0] should have table name Order.
TopLevelTables[0].childern[0] should have table name Item.
TopLevelTables[0].childern[0].childern[0] should have table name Order.
TopLevelTables[1] should have table name Item.

See attached document. Thank you for looking at this for me. I hope this helps.

Hi Don,

Thanks for the details. We are analyzing your requirement and will update you soon.

Best Regards,

Hi Don,

A new feature request to support this feature has been logged into our issue tracking system as WORDSNET-12309. We will keep you updated on this issue in this thread.

Please also check the details about our new reporting engine at http://www.aspose.com/docs/display/wordsnet/LINQ+Reporting+Engine+Programmers+Guide.

The issues you have found earlier (filed as WORDSNET-12309) have been fixed in this .NET update and this Java update.

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

It is to update you that we have added the MailMergeRegionInfo public class and the MailMerge.GetRegionsHierachy public method. These allow to obtain mail merge hierarchy including child regions and fields. Please see the following usecase for extracting full hierarchy of regions available in the document.

Document doc = TestUtil.Open(@"in.doc");

MailMergeRegionInfo regionInfo = doc.MailMerge.GetRegionsHierarchy();

ArrayList /**/ topRegions = regionInfo.Regions;

Assert.AreEqual(2, topRegions.Count);

Assert.AreEqual(((MailMergeRegionInfo)topRegions[0]).Name, "Region1");

Assert.AreEqual(((MailMergeRegionInfo)topRegions[1]).Name, "Region2");

ArrayList /**/ nestedRegions = ((MailMergeRegionInfo)topRegions[0]).Regions;

Assert.AreEqual(2, nestedRegions.Count);

Assert.AreEqual(((MailMergeRegionInfo)nestedRegions[0]).Name, "NestedRegion1");

Assert.AreEqual(((MailMergeRegionInfo)nestedRegions[1]).Name, "NestedRegion2");

nestedRegions = ((MailMergeRegionInfo)topRegions[1]).Regions;

Assert.AreEqual(2, nestedRegions.Count);

Assert.AreEqual(((MailMergeRegionInfo)nestedRegions[0]).Name, "NestedRegion1");

Assert.AreEqual(((MailMergeRegionInfo)nestedRegions[1]).Name, "NestedRegion2");

Hope, this helps.

Best regards,

Thank you very much for your response in addressing this requirement with an update and for the code sample.