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

Free Support Forum - aspose.com

ArgumetOutOfRangeException on Document.Save with ExecuteWithRegion MailMerge call


I’m trying to use Aspose.Word for making a complex PDF.
I’m generally getting good results, but I have a strange bug when I have more than 2 subtrees in my input datas.
I’m using ExecuteWithRegion with a home-maid IMailMergeDataSourceRoot implementation.
When I call Document.Save, a System.ArgumetOutOfRangeException is raised.

The diffrence between a working xml data file and a not-working xml data file is described in the attached png screenshot
AsposeDebug.zip (885.4 KB)
XmlComparison.png (33.0 KB)

I’va attached to this post a complele debugging VS project for easy problem reproducing. Two xml sample files (used for screenshot) are included.

I don’t understand if I’m doing something wrong or id I encountered a real bug.

Can you help me please ?

Best regards


Thanks for your inquiry. You are using multiple Aspose API. Unfortunately, we are unable to execute your code example. Please create a simple console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing. Thanks for your cooperation.

Thanks for your answer. The project that I’ve sent is already a simple console application, can you give me some precsions about compilation error you met ? Thanks.

I tried to simplify test project.
AsposeDebug.zip (854.2 KB)
Only one package NuGet is used from now. I’ve deleted NuGet package for making a little zip, you have to restore it before build. The program is now set to show exception without code modification.
I hope this can let you reproduce my problem.


Thanks for sharing the detail. Please check the attached image for error detail. Error Detail.png (27.1 KB)

Thank you for the image. Ok, I understand : I used a new feature available in C# 6 called “inline declaration”.
I’ve updated project in converting this to its old style. You should be able to build solution with new attached zip.AsposeDebug.zip (855.3 KB)
Thanks in advance.


Thanks for sharing the detail. We have tested the scenario and have not found the shared issue. You are facing this issue due to license. We have attached the output PDF with this post for your kind reference.
TestDevisModel.pdf (132.2 KB)

Please request for 30-days temporary license from following link.
Get a Temporary License

Please refer to following article about applying license.
Applying a License

Thank you a lot for your answer ! The output PDF is exactly what I expected to get.
I will request a temporary license as soon as my customer will choose what kind of license he wants.

Best regards.


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.