Periodic failures generating blank documents

Hi,


We are having an intermittent problem, whereby documents will be generating correctly and then suddenly all new documents created will be blank. (across all templates)

To fix the problem we have to recycle the application and then the same exact documents will generate correctly.

I was just wondering if you had seen this problem before. We are using version 13.2. I know the response is likely to be just to upgrade to version 14 and then try again, but this will take significant resource to upgrade and then regression test the application.

I was really hoping someone might have seen this before and know what might cause this. I found this similar post, but unfortunately there is no recent update. Mail merge generates blanks pages using .NET - #5 by robbirdman - Free Support Forum - aspose.com

Any help would be greatly appreciated!

Thanks in advance,
Rob


Hi Robert,


Thanks for your inquiry. This doesn’t seem to be a problem with mail merge engine of Aspose.Words rather something likely gets changed in your machine which is causing this issue. When saying that “suddenly all new documents created will be blank”, does this problem occur only when you use mail merge functionality or after this incident happens, simply doing an open/save operation with Aspose.Words on your template Word document still produces a blank output?

It would be great if you could create a runnable application that helps us reproduce your problem on our end and attach it here for testing. Please also attach your sample word document and blank output document here for testing. As soon as you get this pieces of information ready, we’ll start further investigation into your issue and provide you more information.

Best regards,

Thanks for the response Awais!


We have managed to track down what was causing our issue. It was due to incorrectly matched table start/end tags.We actually allow clients to build they own templates and in this example they had started the same table multiple times, but only closed it once.

The strange thing was that after this document had been created for the first time, it seemed to break all subsequent documents from being generated (from any of the other templates too)

This seems to be to do with Aspose having a static behaviour, so in this case one invalid template can affect all future document generation which is not ideal. It would be great if there was some sort of reset function we could call to tidy up after a document has been generated.

For now, we have now put some basic validation in place to try to check the tags in the template and stop this happening again.

I would love to provide you with the document, but because it was created by a client I’m not allowed to. But hopefully this information may provide you with a test case to reproduce this behaviour. Let me know if there is any more information I can provide.

Thanks,
Rob

Hi Rob,


Thanks for the additional information. Please share that invalid template along with piece of code causing this issue with us. Please note that it is safe to attach files in the forum. If you attach your document(s) here, only you and Aspose staff members can download it. Also you can zip these files and send it to my e-mail as described here:

Best regards,

Hi,

I had posted this same issue on the other thread that is mentioned in the first question by Rob. We are still experiencing this same issue and thanks to Rob, i was able to reproduce it the same way as well. Is there any other workaround we can utilize in the meantime to get around the problem other than validating all templates to ensure they are correct? Is there a way to reset/dispose off all Aspose Words resources prior to generating the output for each template?

We have had this issue open for a few years now and a quick fix would be appreciated.

Thanks
Hrishi

Hi Hrishi,


Thanks for the additional information. We are in communication with our development team and will get back to you soon.

Best regards,

To give some additional information on this issue -

See attached sample mail merge template. You will notice three tables in the document. The first one has a TableStart but no matching TableEnd. The other two have TableStart and TableEnds. When trying to execute a document.MailMerge.ExecuteWithRegions(dataview) on this document, the first time, we get an output with a blank first table and rest of the document empty. If i try the mail merge again, the entire document is blank. After that any other valid documents also get output as blank. So it seems like the missing TableEnd after the first mail merge attempt causes it to reach in a state that causes subsequent outputs to be blank.

Please try to resolve this issue as soon as possible as this is causing a lot of pain for our clients in using the mail merge functionality.

Thanks
Hrishi

Hi Hrishi,


Thanks for the additional information. I am working over your query and will get back to you soon.

Best regards,

Hi Hrishi,


I just wanted to say thanks for following up on this ticket and providing a sample to illustrate the issue!

Aspose - Hopefully this will allow you to track down and solve this problem. I really think that fixing this issue will make the product a lot more robust and able to handle errors in isolation. Good luck and I’m eagerly looking forward to the release containing this fix.

Thanks,
Rob

Hi Hrishi,


Thanks for being patient.

Considering the “CommitmentMailMergeTemplate.doc”, the latest version of Aspose.Words 14.4.0 is not able to merge values in any of the three regions in this document. But, if you fix the missing TableEnd field problem of first mail merge region, the mail merge with regions functionality of Aspose.Words will start working normally. I have logged this problem in our issue tracking system as WORDSNET-10123. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

However, I am unable to reproduce the original “Blank output” problem. Can you please upgrade to the latest version (14.4.0) and see if it resolves this problem now? The latest version 14.4.0 now ignores MailMergeCleanupOptions.RemoveUnusedRegions option during simple mail merge (MailMerge.Execute) operation. Previously, when there was no mail merge region defined in template document and simple mail merge was performed using an empty data source after specifying MailMergeCleanupOptions.RemoveUnusedRegions, Aspose.Words used to produce an empty output document. This was because simple mail merge is technically a particular case of mail merge with regions where the whole document acts as a single region. Now starting with 14.4.0 release, simple mail merge is no more affected by the MailMergeCleanupOptions.RemoveUnusedRegions option since it is meaningless to produce empty documents.

Best regards,

Hi Hrishi,


Thanks for being patient. Regarding WORDSNET-10123, our development team has completed the work on your issue and has come to a conclusion that they won’t be able to implement the fix to your issue. Your issue (WORDSNET-10123) is now closed with ‘Won’t Fix’ resolution. So, please note that both TableStart and TableEnd fields are required. Aspose.Words parses regions as follows:

  • Loop through all fields
  • If field is TableStart, push new region in regions stack
  • If field is TableEnd and this region exists in stack, add this region to the result collection of regions.

The test file (CommitmentMailMergeTemplate.doc) does not contain TableEnd for the first region. Therefore the first region (and child regions) misses the resulting collection of regions. So, you need to fix this template document before performing an execute with regions operation.

Best regards,