Free Support Forum - aspose.com

MailMerger bookmarks using aspose.words

Hi I want to do mailmerger using Bookmarks in my template, these is how I want to go about doing it, I have controls like textbox where I type in values say for example my name and when I click submit it should create a new document and update like these in the new document in the place holder for name it should have my name, can you please send me some sample code of how i'll go about in doing that, and I have a gridview as well which I want to export it to the new document, I'd really appreciate if you can help me with these.

Regards

Hi

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

Thank you for your interest in Aspose.Words. You can find a lot of such code examples in our documentation. Please see the following link to learn more about mail merge feature:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/mail-merge-and-reporting.html

Here you can learn more about bookmarks:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/working-with-bookmarks.html

Hope this helps. Please let me know if you need more assistance, I will be glad to help you.

Best regards,

Hi,

The example there is for when I am using fields can you send me for one whereby you are using Bookmarks. Thanking you in advance.

Regards

Hi

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

Thanks for your request. Please see the following link:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/working-with-bookmarks.html

Please see the following code example:

Document doc = new Document("Bookmark.doc");

// Use the indexer of the Bookmarks collection to obtain the desired bookmark.

Bookmark bookmark = doc.Range.Bookmarks["MyBookmark"];

// Get the name and text of the bookmark.

string name = bookmark.Name;

string text = bookmark.Text;

// Set the name and text of the bookmark.

bookmark.Name = "RenamedBookmark";

bookmark.Text = "This is a new bookmarked text.";

Best regards,