Free Support Forum - aspose.com

Mailing Labels Template (with number designation)

Hello,



I’m working on an automated solution for pulling information from a database and exporting the information to Word Mailing labels. Word allows you to select a template by number, for example, I’m using Avery Labels #5196. Is there a way for me to do this programmatically (VB .NET), or should I just create a template file and use that?



Thanks!

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

Thanks fro your request. Aspose.Words provides mail merge functionality.

So you should create template and use it. For more information see the following links.

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/preparing-a-document.html

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/simple-mail-merge-explained.html

Best regards.

Hello,



I’m not looking to use merge fields. I’m just looking to use a Microsoft Word template for labels.



The attatched image shows pretty much what I need. Rather than store a template somewhere (where someone might move or change it), I’d prefer to automatically select a Word template (#5196). Is this possible?

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

No, unfortunately you can’t do this using Aspose.Words. You can just create template and then perform mail merge to insert data from database into the template.

For example see the following code and attaché documents.

//Open template

Document doc = new Document(@"Test196\in.doc");

string[] names = { "myLable" };

string[] values = { "This is my cool lable" };

//Perform mail merge

doc.MailMerge.Execute(names, values);

//Save output

doc.Save(@"Test196\out.doc");

Best regards.