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

Free Support Forum - aspose.com

Word IF with MERGEFIELD which has a double quote in it generates IllegalStateException


We are using a Word IF statement in our document merge and when we use the following syntax:

{ IF { MERGEFIELD soort } = “B-punt” “{ MERGEFIELD tekstvak1}” }

However when the mergefield tekstvak1 contains any form of double quote Aspose generates an IllegalStateException with no message. We had to figure this out by trial and error.

How can I prevent this from happening?


Hi Bart,

Thanks for your inquiry. Could you please attach your sample Word document and piece of code here for testing? We will then investigate the issue on our end and provide you more information.

Best regards,


I have attached a document with this case. If the mergefield htmlvalue has a double qoute in it (" or “ or ”) we get an illegalStateException with no message. We are using builder.insertHtml() to insert the htmlvalue.



Hi Bart,

Thanks for your inquiry. After an initial test with Aspose.Words 14.6.0, I was unable to reproduce this exception on my side. I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. I hope, this helps.

Best regards,

Sorry for the late reply, I was on holiday.

I have just tested this with 14.6.0 and the problem persists. Are you sure you tried this correctly? I am 100% sure this is a bug caused by the double quote inside of the html.



Hi there,

Thank you for your request. Our support team are looking into this request and will answer as soon as possible, please hold tight.

I was able to reproduce the problem exactly like I stated above.

Please see my attachment.

Hi Bart,

Thanks for the additional information. I tested the scenario and have managed to reproduce the same problem on my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10604. 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.

Best regards,

The issues you have found earlier (filed as WORDSNET-10604) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.