Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Aug 26, 2011 9:17 pm

Hi

I'd like to use the mail merge functionalities extensively with business objects. Imagine that you have an object called "Customer" which contains a subcollection called "Orders" as well as many other subcollections or sub-properties. Can Spire.Doc handle this scenario?

I know that the sample MailMergeEventHandler demonstrates mail merge with objects. But what about sub-collections and sub-properties? Could you provide a small example if this is possible?

Thanks!!

Best regards

Marco

CaptainMarco
 
Posts: 2
Joined: Fri Aug 26, 2011 7:35 pm

Mon Aug 29, 2011 10:17 am

Dear Marco,

Thanks for your inquiry.
There is no direct API to merge subcollections or sub-properties. We made a demo to show you how to merge NestedRegion, it maybe help you.
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Wed Nov 30, 2011 4:07 pm

Harry, thank you so much for the sample!! And sorry for my delay in answering. My priorities shifted during dev, but now I'm back at evaluating Spire.Doc.

The sample helps me achieve what I need to do. But it would be a lot more elegant if I could omit the whole filtering syntax and just have Spire.Doc use the real sub-collections of business objects. You see, in my business objects I won't always have an "ID" field like your sample suggests. So the whole filtering part wouldn't work.

I tried calling ExecuteGroup recursively from within the MergeGroup-event. This works great until an object's sub collection has no items (e.g. Customer.Orders.Count==0). Then Spire.Doc throws an exception that it has already finished enumerating.Using HideEmptyGroup=true does not help either.

Any ideas?

Thanks
Marco

CaptainMarco
 
Posts: 2
Joined: Fri Aug 26, 2011 7:35 pm

Thu Dec 01, 2011 9:52 am

Dear Marco,

Thanks for your inquiry.
You had a good idea, but we need some time to research and provide you a new demo. After that, we will inform you as soon as possible, sorry for that.

Harry
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Fri Dec 02, 2011 8:50 am

Dear Marco,

We could reproduce your issue with an exception. Would you please do us a favor to post your code to help us reproduce your issue, we will try to fix it and this way will be quicker.
Thanks.
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Return to Spire.Doc