Free Support Forum - aspose.com

How to remain Merge Field included in one IF field While IF Field is converting to static text

Hi,

The link below is from your document about how to replace fields with static text:

http://www.aspose.com/docs/display/wordsnet/How+to++Replace+Fields+with+Static+Text

We wrote similar code for our system three years ago, but because our team want to do Aspose upgrade, I’m testing your latest Aspose.Words (13.2) to check whether it breaks any functionality of generating word report. The bad news is it breaks a lot. One is before upgrade, we use 9.2.0 and when converting IF field to static/plain text, and in IF field , it contains some merge field as a placeholder, which will be used after converting, the merge field will be remained. But after upgrade, when running our code or code in the link above, the placeholder merge field will also be converted to static text. For example:
before convert: { IF 1 > 0 “{ MERGEFIELD PlaceHolder }” }
after convert: <> ("<<>>" is just text).
It makes me confused and breaks existing functionality. So could anybody give me any idea that to remain merge field after converting to solve it ? Otherwise, maybe I have to use bookmark as placeholder which is a little complex than mergefield because a lot of code may be added.

Aspsoe.Words is an amazing 3rd party component and helps us a lot. But it seems that the latest version isn’t good enough. I’ll write other posts to list the bugs I found.

thanks.

Hi there,


Thanks for your inquiry.

It sounds like the behavior you have described is correct as because the field is inside the field code of the IF field it will be removed when it is converted to static text.

I think you implied you were using different code to the one found in the documentation with the previous version of Aspose.Words. Have you tried using this older code with the new version of Aspose.Words? Does the issue still remain?

Thanks,

Hi,


No, same code, but different Aspose.Words assemblies, 9.2.0 and 13.2.0. But maybe you’re right, using that code snippet should remove all fields. Maybe in 9.2.0, it was a bug then you guys fixed it. Anyway, we will search another approach to achieve the goal if using the latest one.

thanks.

Hi,


Sure, please let us know any time you have any further queries. We are always glad to help you.

Best regards,