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.


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:
Here you can learn more about bookmarks:
Hope this helps. Please let me know if you need more assistance, I will be glad to help you.
Best regards,

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.


Thanks for your request. Please see the following link:
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,