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

Free Support Forum - aspose.com

Remove Empty Address Lines

Hi,



I am using VB.net and have a mailmerge from a database with 5 address fields, in some instances a line may have no value (i.e. Address2)



I have tried doc.MailMerge.DeleteFields()



and



doc.MailMerge.CleanupOptions = MailMerging.MailMergeCleanupOptions.RemoveUnusedFields



How can I delete the row?



Regards



Tony

Hi Tony,


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document
  • Aspose.Words generated output document which shows the undesired behavior
  • Your expected document which shows the correct output. Please create this document using Microsoft Word application.
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,

Hi,



I have resolved this myself - if anyone else has the same issue, the sample code refers to:



doc.MailMerge.Execute(New String() {“Field1”, “Field2”, “Field3”},

’ New Object() {“Sample”, “”, “Hello”})



In this case the arrays should be created first, followed by:



doc.MailMerge.CleanupOptions = MailMerging.MailMergeCleanupOptions.RemoveEmptyParagraphs



Then



doc.MailMerge.Execute(Names, Values)



Regards



Tony

Hi Tony,


It is great you were able to find what you were looking for. Please let us know any time you have any further queries. Please also check:
http://www.aspose.com/docs/display/wordsnet/How+to++Remove+Unmerged+Fields+and+Empty+Paragraphs+during+Mail+Merge

Best regards,