Free Support Forum - aspose.com

Mail Merge with Ask Fields

Hi,

I am using the evaluation of Aspose.Word for a prospective project. I need to use a template with 'ASK' mail merge fields. basically in MS Word, I can make a template with 'ASK' like Insert->Fields->Mail Merge->Ask ..... After some time of search in the knowledge base, the Aspose.Word forum and the API, I am still not sure if this feature is supported by Aspose.Word. Can anyone give me a yes or no? any help is greatly appreciated.

Word4Net

I presume you want to use Aspose.Word to insert data into ASK fields.

There is no built-in functionality to insert data into ASK fields in Aspose.Word. Mail merge is normally done into MERGEFIELD fields. But when MailMerge.UseNonMergeFields is true, mail merge can be done into MACROBUTTON and IF fields too. I think I can continue this line and support ASK fields for mail merge in the same way. Please post a sample document so I'm sure we are talking about the same thing.

Hi, thanks;

Something like this will be an example

{ASK firstName "what is your first name" \*MERGEFORMAT}

word4net

The way I want to support is this:

1. The field "firstName" must be in your data source.

2. The complete ASK field will be removed during mail merge and the value of the "firstName" field from the data source will be inserted instead.

3. The prompt of the ASK field is completely ignored by Aspose.Word.

Hi, did you ever implement this (in Java)?

I have the following in my Word document:

{ MERGEFIELD Company * MERGEFORMAT }
{ ASK Age “How old are you?” \d “None of your business!” * MERGEFORMAT }
{ Age }

My code looks like:

doc.getMailMerge().execute(new String[] {“Company”, “Age”}, new Object[] {“The Bank”, “39”});

The output looks like:

The Bank
None of your business!

It has used the default Ask value even though the “Age” name/value pair were supplied.

Regards,
Henry

Hi Henry,

Thanks for your request. ASK and FILLIN fields are not actually merge fields. That is why they are not filled upon executing mail merge. If you need to fill these fields, you can use the approach suggested here:

https://forum.aspose.com/t/93387

Hope this helps.

Best regards,