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

Free Support Forum - aspose.com

Using IF fields with nested FILLIN fields in word merge

I have a problem with using IF fields with nested FILLIN fields in word merge functionality. If I have FILLIN field in FalseText and in TrueText parts of IF field then document should ask one time to fill FILLIN field (according to the IF field result). But I cannot see that FalseText of IF field have FILLIN field or TrueText have FILLIN field or both. FalseText or TrueText property of IF field show me empty string when it has any field. I can only see all field code for IF field statement. Does aspose api have some functionality to get content of TrueText and FalseText for IF field with nested FILLIN fields?

Thank you.

@obanar,

FILLIN field is not a merge field that is why Aspose.Words mail merge engine skips it. However, when you update fields using Document.UpdateFields method, the following handler will be called for each FILLIN field found in your template:

Document doc = new Document("E:\\Temp\\Fillin.docx");
doc.FieldOptions.UserPromptRespondent = new HandlePrompts();
doc.UpdateFields();
doc.Save("E:\\Temp\\19.4.docx");

public class HandlePrompts : IFieldUserPromptRespondent
{
    public string Respond(string promptText, string defaultResponse)
    {
        // User response (i.e. confirmed value contained in the prompt window).
        Console.WriteLine("Please enter value for FILLIN  field (" + promptText + "): ");
        return Console.ReadLine();
    }
}

The above code will prompt user to enter values for each FILLIN field. Hope, this helps

That’s exactly what I need. Thank you.