Free Support Forum -

FILLIN/ASK Inside IF Field

I’m using basically the approach described here:

to support FILLIN and ASK fields. I've attached a console application with my exact code (in the PromptAskAndFillInFields method)

However this approach doesn't work correctly when the FILLIN/ASK field is inside of an IF statement.

I end up prompting the user even for every single FILLIN/ASK field, even if it's inside an IF condition that evaluates to false. For example:

{ IF "1"="2" {FILLIN AnswerMe } "" }

will still end up prompting the user. In a document with many FILLIN/ASK fields inside conditionals, this becomes problematic.

Is there any way you can recommend handling this?

Hi Jeff,

Thanks for your query.
It would be great if you please share your document along with some more detail about your query. The following IF condition returns false and will not prompt when you update field in MS Word.

{ IF “1”=“2” {FILLIN AnswerMe } “” }

I’ve attached a functional sample with template.

Note how the user will be prompted even though the ultimate evaluation of IF MERGEFIELD M_88 <> “” is false. Really the user should not be prompted…

Hi Jeff,

I have tested your template document with following code snippet and it works. Please find the Template.doc and output document in attachment.

<span style=“font-family: “Courier New”; color: rgb(43, 145, 175);” lang=“EN-GB”>Document<span style=“font-family: “Courier New”;” lang=“EN-GB”> doc = new
Document(MyDir + “Template.doc”);<o:p></o:p>

String[] fieldNames = new String[] { "M_88", "M_2" };

Object[] fieldValues = new Object[] { "John", "" };

doc.MailMerge.Execute(fieldNames, fieldValues);

doc.Save(MyDir + "AsposeOut.doc");

I have added space before <> in IF condition in source document (Template.doc). Please let us know if you have any more queries.

Hi Jeff,

My name is Dmitry, I and my subteam are responsible for the fields functionality. While Tahir is helping you to find a workaround, I would like to share that: 1) we have just fixed the behavior of the false argument in the IF field so that no fields contained by it are updated anymore; 2) we will add the built-in support for the ASK/FILLIN fields in the next few months.


H Tahir,

I guess I’m not being clear. The problem is not the evaluation of the IF statement. The problem is the FILLIN/ASK implementation. Since the IF condition evaluates to FALSE, I don’t want to prompt the user…but I have no way of knowing that it evaluated to false…so I prompt the user anyway. Have you looked at the code sample I attached?

Does that make sense?


Hi Jeff,

I have worked with your code and have tried to understand your query. As per my understating you want to get the conditional value of IF true/false. You can not get conditional values by using Aspose.Words and MS Word.
<!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:10.0pt; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:47.9pt; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;}


IF "" <> "" FILLIN "Special Notes for John:" \d "

Please let us know if you have any queries.

Ok, but is there at least a way to get Aspose to remove the FILLIN automatically if the IF is FALSE?

Hi Jeff,

The Aspose.Words mimics the same behavior as MS Word do for updating the IF field. The Document.UpdateFields() update the value of fields in the whole document. There no is such way to get the value of IF condition (true/false). However, you can get the value of MailMerge field (
“M_88”) value and compare it in your c# code.

<span style=“font-family: “Courier New”;” lang=“EN-GB”>IF “” <> “” FILLIN “Special
Notes for John:”
\d "

Hope this answers your query. Please let us know if you have any more queries.

Hi Dmitry,

My company is depending on the ASK/FILLIN field support feature being implemented soon. What is the estimate on when this will be implemented?


Hi Mike,

Thank you for your request. If we have enough time, we will implement the support of these fields in the current release (end of August), but most likely it will be included into the next release (end of September).

Thank you for your prompt response Dmitry! I look forward to the update.

Hi Mike,

We have logged this feature as WORDSNET-6767 in our issue tracking system. I have linked this forum thread to the same feature. Hopefully, this feature will be available in September release.

We appreciate you patience.

Was this ASK/FILLIN support included in the October 6th release?

Hi Jeff,

Unfortunately, no. The developer responsible for working on these fields had to interrupt his work and switch to the big RTL text support feature that took a whole month. The good news is that he is back to his work on ASK/FILLIN and it is almost complete. So please expect the support for these fields in the next release for sure. I am sorry for inconvenience.


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

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