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

Free Support Forum - aspose.com

Support for Fill-in fields

When doing a mail merge via Microsoft Word, the functionality is available to have fields that pop up requesting a value which them gets populated and propagated to each copy of the template, does Aspose.Words support this functionality?

@TheMitasGroup,

Please ZIP and upload your sample input Word document here for testing. We will investigate the scenario on our end and provide you more information.

FillInFieldTemplate.zip (9.7 KB)
Here is the requested template.

Thank you

@TheMitasGroup,

Please try using the following code:

Document doc = new Document(MyDir + @"FillInFieldTemplate.dotx");

doc.FieldOptions.UserPromptRespondent = new HandlePrompts();
doc.UpdateFields();

doc.Save(MyDir + @"17.11.docx");

public class HandlePrompts : IFieldUserPromptRespondent
{
    public string Respond(string promptText, string defaultResponse)
    {
        // User response (i.e. confirmed value contained in the prompt window).
        return "value";
    }
}

Thank you for the advise, however this looks like a solution provided is for just one form and we would have to code this for each form being generated. We have incorporated the aspose word technology allowing the our users to specify a template they have created with a datasource we return merging the datasource data onto the template. Is there a way that we can use Words functionality to pop up a dialog box asking for the fill-in field value and then populate the value on the template we are merging the data with?

@TheMitasGroup,

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:

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.

A post was split to a new topic: Support for Fill-in fields in Java