Free Support Forum - aspose.com

Double quote disappearing within a conditional If fields after the merge

Hi,

I am merging my word template thru Aspose API for .net. I have a template where I have "If conitional statement" and then I want to put dynamic text in case if condition evaluates to true. The dynamic text has double quotes (") in it like (Exhibit "A") and that is disappearing after the merge and appearing as (Exhibit A). Do you have any suggestions like some sort of encoding or any other technique to get rid of this proeblem? I will really appreciate your suggestions.

Thx

Thanmal.

Hi Thanmal,

Thanks for your request. Could you please attach your template and provide a simple code example that will allow us to reproduce the problem? We will check the issue and provide you more information.

Best regards,

Hi,

Please find the attached template(Table_ExpressionProblem1.doc) and resultant document after the merge thru aspose API calls (out_Merged.doc). The original doc has two autotext fields. Loop0_Field1 and Loop0_Field2. The values for these autotext fields are "Loop0_Field1" and "Exhibit "A"".

As you can see in the resultant document, the autitext field value for second field (Exhibit "A") prints fine just on it's own when it is outside any IF condition but when used inside of an If condition block it only prints (Exhibit A) and misses the quote totally.

The code I am using currently in my app is quite big. If you are not able to reproduce the problem by just writing simple aspose API to parse and merge, I will try to reporduce the problem in a simple standalone application. But if you use standard aspose API to process the document for merge and do a doc.UpdateField() call to process the IF condition, I am pretty sure you can see the issue.

Please let me know ASAP if you are not able to reproduce the problem.

Thx

Thanmal.

Hi

Thank you for additional information. Now it is more clear. The fact is that double quotes are special character within IF field. They mark condition values and true/false values of IF field. I think, in your case, you can replace double quotes of your values to something else. Single quotes for instance.

Best regards,

Hi,

thx for your reply. Is there any way to do the double quote as the business/legal requirement requires to do that? Remeber this is a dynamic text coming out of the DB and I replace the autotext value with this value in the IF conditional expression. One possibility is to use {QUOTE 34} but I am not sure how I will look into my text string and replace the double quote(") with a word field {QUOTE 34} using ASPOSE API. Any suggestions are greatly appreciated.

Thx
Thanaml.

Hi

Thank you for additional information. Could you please provide your code that you are using to put values from database into the document? We will check the issue and provide you more information.

Best regards,

Hi,

We are going with replacing double quote with two single quote approach. If that works and business if fine than I going to roll out with that. If not I will get back to you with the code.

Thx for your help!

Thanmal.

Hi

Thank you for additional information. I think, you can also replace double quotes with one of the following characters: “ ”. They look as double quotes, but technically they are not the double quotes. So they should work fine for you.

Best regards,