Free Support Forum -

Mailmerger using aspose with bookmarks

<o:shapelayout v:ext=“edit”>
<o:idmap v:ext=“edit” data=“1” />


I am doing mail merger using bookmarks this is my code

string exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

string docsDir = Path.GetFullPath(Path.Combine(exeDir, @"..\..\..\_Documents\"));

// Load the template document.

Aspose.Words.Document doc = new Aspose.Words.Document(docsDir + "CustomerQuote.dotx");

Aspose.Words.Bookmark oCustomerName = doc.Range.Bookmarks["CUSTOMERNAME"];

Aspose.Words.Bookmark oCompanyName = doc.Range.Bookmarks["COMPANYNAME"];

Aspose.Words.Bookmark oCustomerSurname = doc.Range.Bookmarks["CustomerSurname"];

Aspose.Words.Bookmark oTelNumber = doc.Range.Bookmarks["TELNUMBER"];

Aspose.Words.Bookmark oEmail = doc.Range.Bookmarks["EMAIL"];

Aspose.Words.Bookmark oDate = doc.Range.Bookmarks["DATE"];

Aspose.Words.Bookmark oSalesPerson = doc.Range.Bookmarks["SALESPERSON"];

Aspose.Words.Bookmark oUserEmail = doc.Range.Bookmarks["UserEmail"];

string CustomerName = txtFirstName.Text;

oCustomerName.Text = txtFirstName.ToString();

string CompanyName = txtCompanyName.Text;

oCompanyName.Text = txtCompanyName.ToString();

string CustomerSurname = txtLastName.Text;

oCustomerSurname.Text = txtLastName.ToString();

string TelNumber = txtTelNumber.Text;

oTelNumber = txtTelNumber.ToString();

string Email = txtEmail.Text;

//oEmail = txtEmail.ToString();


new string[] { CustomerName },

new object[] { oCustomerName });

// Save the finished document.

doc.Save(Path.Combine(docsDir, "123.doc"));

I am not sure as to where I am getting these please help

This message was posted using Email2Forum by ShL77.


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

Thanks for your request. Unfortunately, it is not quite clear for me what your problem is. Could you please describe your issue more specifically and provide sample documents here for testing? I will check the issue on my side and provide you more information.

Best regards,