I’m attempting to do this in java and I’m unable to get any prompting after many tries.
Here is an example of my code:
String[] tokentest = new String[]{ "case", "case_status", "status_date" };
String[] datatest = new String[]{ "2002 CRIM 509", "Open", "01/01/2022" };
doc.getFieldOptions().setUserPromptRespondent(new HandlePrompts());
doc.updateFields();
doc.getMailMerge().execute(tokentest, datatest);
public class HandlePrompts implements IFieldUserPromptRespondent
{
@Override
public String respond(String promptText, String defaultResponse) {
// TODO Auto-generated method stub
return "";
}
}
If I return no value I’m at least able to select Ctrl+A and F9 to get the prompt to trigger after the document opens but I thought the updateFields() command triggered this automatically.
I’ve attempted to use System.console() in java to attempt to get this prompting but it’s null so I can’t use that or I get a NPE.
public class HandlePrompts implements IFieldUserPromptRespondent
{
@Override
public String respond(String promptText, String defaultResponse) {
// TODO Auto-generated method stub
System.out.println("Console is: " + System.console());
System.console().writer().write("Please enter value for FILLIN field (" + promptText + "): ");
return System.console().readLine();
}
}
}
Is there any known way to prompt the user in java or do I need to build something inside of the respond method to handle this myself?
I have attached the template I am testing in case my set up is wrong. I have also included a screen print of the desired result and how it works when opening the document in word.
AsposeDocs.7z (335.2 KB)