Mail Merge Feature request: Preserve text tags on unused fields

Current behavior:

When using the MailMerge.UseNonMergeFields = true option to merge mustache style tags {{ }}, the tags are converted into MERGEFIELD if it is unused.

Example:

{{MyMergeField}} will output as <<MyMergeField>>

Is it possible to add an option to keep the original tags if the fields are unused?

Example:

{{MyMergeField}} will keep its original tags and output as {{MyMergeField}} if it is unused

Thanks,
Minh

Also, is it possible to include the complete merge field in the FieldMergingArgs?

This can be useful when implementing IFieldMergingCallback.

For example, if it’s a mustache style merge field, include {{MyMergeField}} as a property on the FieldMergingArgs.

If it’s a Word merge field include {MERGEFIELD "MyMergeField"} or something similar.

Thanks,
Minh

Hi Minh,

Thanks for your inquiry.

minhorchestratellc:
Is it possible to add an option to keep the original tags if the fields are unused?

We have logged this feature request as WORDSNET-12738 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.

*minhorchestratellc:
Also, is it possible to include the complete merge field in the FieldMergingArgs?

For example, if it’s a mustache style merge field, include {{MyMergeField}} as a property on the FieldMergingArgs.

If it’s a Word merge field include {MERGEFIELD “MyMergeField”} or something similar.*

You can get the Field’s object using FieldMergingArgsBase.Field property. Once you have field object, you can get the field’s code using Field.GetFieldCode method. Hope this helps you. Please let us know if you have any more queries.

Tahir, thanks for the quick response.

The Field.GetFieldCode method will return MERGEFIELD even if it’s a text tag {{ }}, maybe if WORDSNET-12738 is implemented, the GetFieldCode method will return {{ }} instead of MERGEFIELD.

Thanks

Hi Minh,

Thanks for your inquiry. You can get the field’s name from field’s result or field code. Please check following code example to achieve your requirements.

Hope this helps you. Please let us know if you have any more queries.

Field field = …
field.Update();
Console.WriteLine(field.Result.Replace("«", "").Replace("»", ""));
Console.WriteLine(field.GetFieldCode().Replace("MERGEFIELD", "").Trim().Split(' ')[0]);

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

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

Hi,

It is to update you that we have added a capability to preserve mustache tags that haven’t been populated. You can now use MailMerge.PreserveUnusedTags property to get or set a value indicating whether the unused “mustache” tags should be preserved. The default value is false.

Best regards,