Free Support Forum - aspose.cloud

An issue when a "merge field" value is empty

At the moment, if we don’t send any data for certain field. The merge field code will get inserted into the final document. We don’t need to have the merge field code inserted in the final document when it’s value is empty.

Do you have any suggestions for this case or does Aspose platform handle this case in some setting or so?

Thanks.

@Softwareselskabet

Thank you for contacting Aspose Support.

I am going to reproduce your Use Case at my end and will share my findings with you shortly.

@Softwareselskabet

Please use cleanup options parameter it will server your purpose. This String parameter has 4 possible values:

  1. ContainingFields
  2. EmptyParagraphs
  3. UnusedFields
  4. UnusedRegions

Setting cleanup = UnusedFields will remove the unused fields. A comma-separated list of options can be used as well.

Please check our SDKs for Aspose.Words APIs examples.