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

Free Support Forum - aspose.com

Aspose Words Java- executeWithRegions() not working

I'm trying to use Aspose Words for Java. I have a docx document with merge fields, and regions.

I've implemented IMailMergeDataSource and am trying to use executeWithRegions, with that implementation. None of the methods of my class seem to be called and I see no fields replaced in the resulting pdf.

When I pass the same object to execute() my data is picked up, but obviously nothing is done with my "StartTable:" markers...


Hi

Thanks for your request. Could you please attach your template here for testing? I will check the issue and provide you more information.

Best regards,

I think I have found my problem. I did not have a TableStart at the very start of the document, nor the matching TableEnd (I have nested regions).

But now I’ve added these and I get an Exception about the fact that the region spans multiple sections. The document indeed has two sections which the outer region spans (I needed different margins). Is there a way around the need for there to be only one section in a region?

As a work-around I removed my section break. But now I get an exception…


java.lang.IllegalArgumentException: position
at asposewobfuscated.kg.a(MiscUtil.java:323)
at com.aspose.words.fg.a(DocumentLayoutBuilder.java:254)
at com.aspose.words.fg.a(DocumentLayoutBuilder.java:30)
at com.aspose.words.vp.a(LayoutDocument.java:44)
at com.aspose.words.Document.updatePageLayout(Document.java:1416)
at com.aspose.words.Document.af(Document.java:1349)
at com.aspose.words.Document.AR(Document.java:1362)
at com.aspose.words.Field.Gk(Field.java:455)
at com.aspose.words.Field.a(Field.java:390)
at com.aspose.words.oo.a(FieldUpdater.java:154)
at com.aspose.words.oo.l(FieldUpdater.java:107)
at com.aspose.words.ol.execute(FieldUpdateExecutionItem.java:82)
at com.aspose.words.oo.hm(FieldUpdater.java:97)
at com.aspose.words.oo.Jr(FieldUpdater.java:84)
at com.aspose.words.yj.UL(MailMergeRegion.java:240)
at com.aspose.words.yj.a(MailMergeRegion.java:71)
at com.aspose.words.MailMerge.executeWithRegions(MailMerge.java:330)
at nl.hsac.aspose.OpenDocx.main(OpenDocx.java:47)

Hi

Thank you for additional information. Could you please also provide a code that will allow us to reproduce the problem? We will check the issue and provide you more information.

Best regards,

Since I created a separate thread for the exception I think we should not go into more information about that here.

On the question in my earlier post: are there any plans to support regions that span multiple sections in Word?

Hi

Thanks for your request. No, currently we do not have any plans to support section break within regions. This can cause a lot of problems. I think this will make more harm than good.

Best regards,