One of our customers using our reporting system that uses Aspose Words is seeing this issue (we are using 10.8.0).
Hi Dylan,
Please accept my apology for late response. I have tested the scenario and have not found any issue with REMOVE_EMPTY_PARAGRAPHS at my end. Please use the latest version of Aspose.Words for Java 11.0.0 and let us know, If you still face problem. I have noticed that you have not shared the complete code, please share your complete code for investigation purposes.
Here is a self-contained example of the issue, you should just be able to run it (make sure to have the previously attached docx file in the same directory and see in the console output the unexpected illegal state exception.
Hi Dylan,
I have worked with your code and like to share with you that you are using executeWithRegions method for simple mail merge (mail merge without regions). Please use Execute method instead of executeWithRegions, see the following code snippet.
Please read following documentation links for your kind reference.
try {
wordDoc.getMailMerge().execute(dataSource);//.executeWithRegions(dataSource);
}
catch (IllegalStateException ise) {
System.out.println("ILLEGAL STATE EXCEPTION(EMPTY REGION): " + ise.getMessage());
}
I’m afraid you are incorrect. I am using Mail Merge Regions for actual Mail Merge Region merging, and the same thing cannot be accomplished in my production code with a normal Mail Merge.
This example is very simple, yes, and the same thing here can be changed to work without regions, but that is not the point. The point of this code was to demonstrate to you an issue I am having with Mail Merge Regions. Please trust me that I am using Mail Merge Regions to actually merge regions. Our full reporting code has multiple types of data sources, each with multiple data entries, several with various levels of child data sources, and we use regions to merge that data into tables using a customer-created template. Switching to a simple “.execute(dataSource)” call winds up with leaving the entire region in the document and not merging it at all.
And I am sorry, but the two pieces of documentation you linked me to provide me with no information about why you think I am using executeWithRegions incorrectly. In fact, several entries up in your documentation this page: https://docs.aspose.com/words/java/mail-merge-and-reporting/ seems to verify that I am indeed using it correctly. I honestly don’t understand why you would suggest that I am incorrectly using
“executeWithRegions()” and that I should be using “execute()”, because my template
clearly contains “TableStart” and “TableEnd” merge fields, which are
recognized by Aspose as regions.
As I said, the templates we are running this merge against are customer-created, so we cannot always be certain of their contents. We have run into a customer having empty region templates, and so would like Aspose to be able to handle this case gracefully.
I have provided a simple way for you to reproduce the error we are seeing (I have attached an even more simple docx file you can run my provided code against, if you like). When you run the code that I have provided, are you seeing the same error? If so I would reiterate my original question and ask if there is a workaround for this error and whether or not a fix for this issue is/will be scheduled for an upcoming release.
Hi Dylan,
Great, thank you! Let me know if there’s anything else I can do to help diagnose the issue, or if you need more information.
-Dylan Gulick
Jama Software
Hi Jama,
Hi Adam,
Could you please clarify what you meant as a bug and what will be changed here? According to Aspose documentation starting from v.10.8.0 the option removes now header (TableStart:XXX) and footer (TableEnd:XXX) paragraphs and we have already updated the documents.
Please do not revert the logic back as this breaks the documents which were already changed! I suggest you do not restore the old functionality but to introduce a new flag like "RemoveTableRegionTags" which can handle an apperance logic for start and elements.
Best regards, Evgeniy
Hi Evgeniy,
The issues you have found earlier (filed as WORDSNET-5912) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.