Free Support Forum -

Mail merging addresses - blank lines need to be removed like in Word


We have just switched from automating Word to using Aspose.Word.

We have found that Word automatically removed any blank lines when outputting for example addresses with one field per line which is ideal as we don’t want big gaps in the middle of addresses. However Aspose.Word just leaves the blank lines in there.

Can you possibly make it work in the same way that Word does it as our customers don’t like it working this way - it looks very poor with the gaps in the addresses in letters and labels for example.

If this can be added an option that will be fine.



Hi Nick,

Thanks, I think it is a very good idea and I will implement it in the next hotfix. It is due out just in a few days.

Hi Nick,

Please download latest Aspose.Word 1.2.2 that has an option to remove these empty lines.

Here it is in the documentation Aspose.word.MailMerge.RemoveEmptyParagraphs.

Thank you for the super fast turnaround.

I’ll check out this feature shortly and will let you know how well it works for us :slight_smile:

Do you have any idea yet when your component will support text boxes? This was the first hurdle we fell over with out customer before realizing Aspose.Word did not support them. Also are there any other features of Word documents that you think Aspose.Word cannot support in a mail merge template?

We are working on textboxes (and any office drawing with text) right now. It will be ready in Aspose.Word 1.3 at the end of the month.

The features that we don’t support yet are footnotes, endnotes, annotations and bookmarks. A document with bookmars will read okay, they just will not be preserved on save.

Let me know if some features are particularly important. We eventually plan to support everything, it is justa question of priority.


Thanks for giving the list of features to be implemented in the next release - that is great news!

One other thing…

Our customers have a lot of Word templates that they would like to use for mail merging. However most of them are protected in one way or another using Word’s protect document feature.

When they run a mail merge the output just crashes Word when opened.

I know they can just unprotect the template but they often forget and their computers become unusable when Word crashes when opening the output file as they don’t know how to kill off Word and recognize that they must unprotect the template first.

We would ideally like to mail merge into merge fields that are part of the protected document. Alternatively, to be able to unprotect a template do the merge and re-protect the merged document afterwards.

Looking at the Protect method it allows us to unprotect or protect using different protection methods. Is it possible to unprotect and protect documents or templates that use a password? I can’t see where we would enter a password.

I think that after the changes you proposed for release 1.3 and this protection, that should be everything we need for now. the other items you mentioned will be great bu no hurry on our part for now.

Thank you for your excellent support!

Nick Hobbs

Aspose.Word does not care if the document is protected or not and should open and save protected documents okay.

I would expect if a document is protected using a password you can process it in Aspose.Word and save and still will be protected using the same password. From what you are saying this feature should be enough for you, right?

If Word crashes on files produced by Aspose.Word then please send the original file you are trying to work with to and explain what you are doing with it.

We cannot provide you an option to specify protection password in Aspose.Word because it is undocumented how to hash the password in the Word document.

I’m sorry. This is one I had not tried to reproduce myself, and having done so now have spotted what my colleague was doing wrong. It works nicely thank you, and thanks for confirming my queries about protection - that is just what I want :slight_smile:

Hi Roman

Another quick question - I can protect and unprotect documents, but is it possible to find out whether a document is protected or not? I didn’t find anything in Aspose.Wrod or even in Microsoft Word that would indicate whether a document is protected without trying to do something that violates the protection in Microsoft Word itself and throws an error.



Hi Nick,

Thanks, this is a good idea. I’ve just added Document.ProtectionType that can be get or set. We initially created Protect and Unprotect methods to mimic MS Word object model, I will leave them too.

That is fantastic thank you! It makes document protection work better than Microsoft Word in this resepect :slight_smile:

Are you planning a hotfix for it or will it be rolled into the next release at the end of the month?

Best regards

Nick Hobbs

A hotfix would be great as we are getting overdue on implementing this functionality for our customer. Thanks.

Hi Nick,

We are in the middle of adding a new feature and doing another hotfix will be a significant overhead for us given the proper release is only a few days away.

If it helps, you can use Protect() and Unprotect() methods regardless of whether the document is protected or not. I think this is not like in Word were it throws an exception of you try to unprotect a non protected document or something like that.


Just wondering when the next release is expected to be available to us, with the Protected method in as discussed above? We could do with it now :slight_smile:



Thanks for your interest. We are thorugh final touches, it should be out later today.

Hi Nick,

Aspose.Word 1.3 is out, click here for more details.

Thanks mate!