Free Support Forum - aspose.com

Mail Merge Avery Labels

Hello there,

Could you please guide me how to process Mail Merge for Avery Labels.

Thank you!

Any comments on this?

Thank you!

Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Maybe you can use the technique as described here:

http://www.aspose.com/community/forums/thread/171403/label-sample-code.aspx

Hope this helps.

Best regards,

Thanks for the link Alexey.

I have gone through it and it is suggested to create TableStart/TableEnd Merge regions.

I have done MailMerge.ExecuteWithRegions() a couple of times.
But I am a bit confused on how I will move to individual address labels in an Avery Label document at run time.

As you must be knowing, Avery Label document will have different no. and size of labels depending on the Avery product no. end user selects.

Could you please guide me further.

Thank you!

Any comments on this?


Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Have you tried the example provided in the forum thread I linked to? I also attached template and output document there.

If such technique does not fit to your needs, could you please attach your template and expected output? I will check your inputs and provide you more information.

Best regards.

Thanks Alexey,

Yes, I tried the example provided in above link.

But when I run same for my template(attached), it throws the error:
Mail merge region ‘Labels’ is badly formed. TableStart and TableEnd should be in the same section, same table row or same table cell.

I tried with same set of rows you have provided as an example in above thread for MailMerge.ExecuteWithRegions()

Please guide.

Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. Actually, if you look at your document one more time, you will see that there are two text columns, and the table has only one column. So TableStart and TableEnd mergefield are in different rows, which is not allowed. That is why the exception is thrown. I modified your template. Please see the attached document.

Best regards,

Thanks for your reply Alexey.

Could you please tell me how can I see if these are two text columns instead of table columns.

Further, as our clients use Avery Labels, I need to use Label templete generated by Avery wizard.
The previous template document that I sent you was for Avery Label(Product No. L7162).
Then I added the Merge Fields manually after opening it.

Could you please tell me how can I run the Mail Merge for such Avery Label templates.

Thank you!

Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You can see that there are two text columns if you open this document in MS Word.

Please attach the source template, which you need to use. I will check it and provide you more information.

Best regards.

I think I do not understand when you say text columns, can you please elaborate more.

All I can see is a table with two columns in the attached template (the attached document is same as I attached earlier). I can even see ‘Merge Cells’ option when right click Table handler at top left.

Also, please consider this document as a template against which I need to run mail merge.
If it is not possible to run mail merge against this document, how can I modify it at run time to execute mail merge for it.

Waiting your response.

Thank you!

Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Please find the attached screenshot. You can see that there are two columns in this section. Also if you place cursor in the first cell of this table and try to move it to the next cell using “Tab”, cursor will be moved to the cell below current.

Best regards.

hmm… I can see that now. Thanks for explaining.

I will be having only such templates as they are created from Avery wizard.
Could you please help me in finding a way to mail merge addresses for such templates.



Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I already provided you the modified template, which you can use in mail merge process. Have you tried using the modified template I provided?

Best regards.

Two queries:

1. As, I have discussed with you, end user is going to upload the source template he gets from Avery wizard. Do I need to modify the template manually before running mail merge?
It would be great if I can modify such templates at run-time to execute mail-merge against it.

2. The modified template that you attached has TableStart and TableEnd both in the same cell.
So, instead of creating separate labels, mail merge just append all records one after another in same table cell.
Attached is the output that I get after running mail merge against that template.

Waiting your response.

Hello Alexey,

Any update on this?
I need it soon for a client demo, so If you can provide support, would be great.

Thank you!

Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I think, it should be not difficult for you to modify the template. For example you can use the following structure:

«TableStart: Labels»

«Name »

«Address»

«TableEnd: Labels»

See the attached template for example.

Maybe in your case, if you recaive the template as a document with empty table, it will be better to fill the table with data using DocumentBuider.

Best regards.

Thanks a lot Alexey,

Could you please guide the steps to convert attached Avery template to the one you attached in your last post.

I tried modifying Avery Label L7162.docx by deleting all the cells except first at top left and adding Merge Fields… but I couldn’t add TableStart tag without altering Top Margin :frowning:

How can I modify my template as yours without altering all four margins.

Thank you!

Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I created simple video to show you how you can modify your template. See the attachment.

Best regards.

Thanks Alexey,

That was really a great help!