Free Support Forum - aspose.com

Mail merge is removing parent table if child table data is not set as empty tag

Dear Aspose Team,

I am licensed user(arvind.bhatt2@halliburton.com). I hane an issue. I am mail merging with a specific template for available xml data. in following xml Component has child element FluidComponentModel. Problem is that if i set this child as mentioned below then whole FluidModel table is merged in final document and we can see all data.

1
mud1
13.60
m3
1439

13



If i set xml as following. i.e. tag is not specified under tag then entire data is removed. My concern is that how we can get the entire data after mail merge with following xml format even if tag is not defined under tag. Please refer to attach xml and template file for reference.

1
mud1
13.60
m3
1439

13



thanks

arvind

Hi Arvind,


Thanks for your inquiry. We’re checking with this scenario and will get back to you soon.

Best regards,

Hi Arvind,


Thanks for your patience. I have generated a couple of output Word documents using the latest version of Aspose.Words (13.2.0) with different XML data (see attachments) and attached them here for your reference. Please note that when executing mail merge with nested regions there must be proper relationships present between parent and child data in order for the process to work correctly. Please make sure you always define the relationships correctly in XML.

Best regards,

Dear Aspose,

Thanks for your response. We are using the correct xml and template as you sent. We are using Aspose version 11.0.0 and you have used version 13.0.0 is it the reason why i am facing the issue. Can you verify the same with 11.0.0 vesion ?

thanks

arvind

Hi Arvind,


Thanks for your inquiry. This might well be the reason; please upgrade to the latest version of Aspose.Words from here and we welcome you to evaluate the latest version, please read the following article:
http://www.aspose.com/docs/display/wordsnet/Evaluate+Aspose.Words

PS: We don’t provide support for older released versions of Aspose.Words. Please note that we do not provide any fixes or patches for old versions of Aspose products either. All fixes and new features are always added into new versions of our products. So, you will have to upgrade if you need new features or fixes.

Best regards,

Dear Aspose,

thanks for your prompt response. I got the root cause why i am not getting parent node if any of child node is not present. As per your test documents sent earlier everything works fine in both version 11.0.0 and 13.2.0 but issue is that after merging when we call follwing method to remove unused mergefields from final document then in that case parent node is eliminated in that process.

so culprit is RemoveEmptyRegions function which was provided earlier by Aspose. Please analyze this function why it is removing parent node if any child node is not present. You can use same data which you sent us in your last mail.

I have attached program.cs file which contains both test code and definition of RemoveEmptyRegions function provided by Aspose.

doc.Accept(new RemoveEmptyRegions(true));

looking for your prompt response.

regards

arvind

Hi Arvind,


Thanks for the additional information. It’s great you were able to find what you were looking for. I would also suggest you please read the following article to learn more about removing Unmerged Regions from Document
http://www.aspose.com/docs/display/wordsnet/How+to++Remove+Unmerged+Regions+from+a+Document

Please let us know any time you have any further queries.

Best regards,

Thanks for reply.

RemoveUnusedRegions option is working fine for me and all data is displaying in final document with removing unused regions from document. But unused fields present in column of table are still exist and not removed. Please provide me method which can also remove unused fields from document as well as unused regions.

When i use unusedFields option then it removing all kind of unused fiels and regions from document but causing the actual issue for which i reported to aspose.

Please refer to the attached out.docx which was generated using removeunusedregions and still there some unused fields present in document.But in this case i am getting all data from xml.so my concern is to remove all unused fields from this document without loosing any data.

Looking for your prompt response.

regards

arvind

Hi Arvind,


Thanks for your inquiry. Once simple way you can adopt to remove these unused merge fields from your mail merged document is to call MailMerge.DeleteFields method at the very end in your code just before the Document.Save statement. MailMerge.DeleteFields method removes mail merge related fields from the document. I hope, this helps.

Best regards,