Primarily needed something extra from what WORD offers. Add a complete datatable to a document, among with simple fields.
1)
Create a new document
2)
No need to connect any datasource. Add a simple field by going to Insert > Quick Parts > Field (fieldname is case insensitive)
		
		
	
	
		 
	
choose MergeField and write the 'variable' name
	
	
	
		
		
		
		
	
	
		 
	
this will be appear on document as (gray when cursor is on it)
	
	
	
		
		
		
		
	
	
		 the only possible way to delete this field is when is gray, press CTRL + SHIFT + F9, once this combination pressed the MergeField will be removed and will be common text.
	the only possible way to delete this field is when is gray, press CTRL + SHIFT + F9, once this combination pressed the MergeField will be removed and will be common text.
Imagine now that you have 10 spare simple Merge fields, at code level, you feed them as :
	
	
	
		
find more here.
3)
On the same way we doing for the datatable, but to signalize aspose is a table we have to wrap the area with TableStart:Orders TableEnd:Orders (remember no spaces), both are Merge fields (create them as step 2). (fieldname is case insensitive also for tablename)
when we have this Northwind.mdb table
		 
	
we create this document (all as Merge fields)
		 
	
this results a PDF
		 
	
	
	
	
		
this was an introduction because we need to go further, And the case is the join Customer & Orders
using the following template
these resulted
		 
	
where inside on 3 sample pdfs, is like
		 
	
code used :
	
	
	
		
Documents merge & mail merge
	
	
	
		
Wingdings checkbox on mail merge
Normally you add the mailmerge fields as
	
	
	
		
		
		
		
	
	
		 
	
Then on each mailmerge field you turn the font to wingdings
	
	
	
		
		
		
		
	
	
		 
	
Code logic behind
	
	
	
		
ref - build-table-from-datatable
			
			1)
Create a new document
2)
No need to connect any datasource. Add a simple field by going to Insert > Quick Parts > Field (fieldname is case insensitive)
 
	choose MergeField and write the 'variable' name
 
	this will be appear on document as (gray when cursor is on it)
 
	Imagine now that you have 10 spare simple Merge fields, at code level, you feed them as :
		C#:
	
	string[] fieldNames = {
    "RecipientName", "SenderName", "FaxNumber", "PhoneNumber",
    "Subject", "Body", "Urgent", "ForReview", "PleaseComment"
};
object[] fieldValues = {
    "Josh", "Jenny", "123456789", "", "Hello",
    "<b>HTML Body Test message 1</b>", true, false, true
};
//simple Execute is for simple fields
doc.MailMerge.Execute(fieldNames, fieldValues);find more here.
3)
On the same way we doing for the datatable, but to signalize aspose is a table we have to wrap the area with TableStart:Orders TableEnd:Orders (remember no spaces), both are Merge fields (create them as step 2). (fieldname is case insensitive also for tablename)
when we have this Northwind.mdb table
 
	we create this document (all as Merge fields)
 
	this results a PDF
 
	
		C#:
	
	Document doc = new Document(Application.StartupPath + "\\customers.docx");
DataTable customersDT = General.db.GetDATATABLE("select top 5 * from customers");
customersDT.TableName = "Customers";
 //withregion signalize to earch for TableStart
doc.MailMerge.ExecuteWithRegions(customersDT);
doc.Save(string.Format(Application.StartupPath + "\\customers.pdf"));this was an introduction because we need to go further, And the case is the join Customer & Orders
using the following template
these resulted
 
	
 
	
		C#:
	
	Document doc = new Document(Application.StartupPath + "\\Sonu Jain.docx");
DataTable orderTable = General.db.GetDATATABLE(@"select ShipName, orderid, OrderDate from Customers c
                                left join orders on orders.CustomerID = c.CustomerID
                                where c.CustomerID in ('ANTON','AROUT','BERGS','BLAUS')");
int counter = 0;
foreach (DataRow item in orderTable.Rows)
{
    //https://github.com/aspose-words/Aspose.Words-for-.NET/blob/6eb90e63be02ec9c157fe1a0323bb95831ca8f57/Examples/DocsExamples/DocsExamples/Mail%20Merge%20and%20Reporting/Base%20operations.cs
    //clone the document - otherwise we have to LOAD it every time
    Document dstDoc = (Document)doc.Clone(true);
    //query OrderDetails base on /item/ ORDERID field
    DataTable s = General.db.GetDATATABLE(@"select Quantity,Products.ProductName,od.UnitPrice,od.UnitPrice*Quantity as ProductPriceTotal  from (orders
                                            left join [Order Details] as od on od.OrderID = orders.OrderID)
                                            left join Products on Products.ProductID = od.ProductID
                                            where orders.OrderID =" + item["orderid"].ToString());
    s.TableName = "Orders";
    //add the /item/ aka ORDER DataRow information (ORDERID / ORDERDATE / SHIPNAME)
    dstDoc.MailMerge.Execute(item);
    //add sample field COMMENT
    //https://github.com/aspose-words/Aspose.Words-for-.NET/blob/6eb90e63be02ec9c157fe1a0323bb95831ca8f57/Examples/DocsExamples/DocsExamples/Mail%20Merge%20and%20Reporting/Working%20with%20Fields.cs#L36
    dstDoc.MailMerge.Execute(new string[] { "Comment" }, new object[] { "talamska" });
    //add the ORDER DETAILS table
    dstDoc.MailMerge.ExecuteWithRegions(s);
    //save as PDF
    counter++;
    dstDoc.Save(string.Format(Application.StartupPath + "\\order_{0}.pdf", counter++));
}Documents merge & mail merge
		C#:
	
	//clone the document - otherwise we have to LOAD it every time
Document doc1 = (Document)General.doc1.Clone(true);
Document doc2 = (Document)General.doc2.Clone(true);
Document doc3 = (Document)General.doc3.Clone(true);
Document doc4 = (Document)General.doc4.Clone(true);
doc1.MailMerge.Execute(new string[] { "FullName" }, new object[] { "talamsca1" });
doc2.MailMerge.Execute(new string[] { "FullName" }, new object[] { "talamsca2" });
doc3.MailMerge.Execute(new string[] { "FullName" }, new object[] { "talamsca3" });
doc4.MailMerge.Execute(new string[] { "FullName" }, new object[] { "talamsca4" });
//page break between doc1 and doc2 - src - https://forum.aspose.com/t/36247
//doc2.FirstSection.PageSetup.SectionStart = Aspose.Words.SectionStart.NewPage;
doc1.AppendDocument(doc2, ImportFormatMode.KeepSourceFormatting);
doc1.AppendDocument(doc3, ImportFormatMode.KeepSourceFormatting);
doc1.AppendDocument(doc4, ImportFormatMode.KeepSourceFormatting);
doc1.Save(string.Format(AppDomain.CurrentDomain.BaseDirectory + "\\output\\{0}.pdf", customerCode));Wingdings checkbox on mail merge
Normally you add the mailmerge fields as
 
	Then on each mailmerge field you turn the font to wingdings
 
	Code logic behind
		C#:
	
	// WINGDINGS symbols representation with hexadecimal value - https://www.alanwood.net/demos/wingdings.html
int certificateType = (record.certificateType.HasValue ? record.certificateType.Value : 1);
string wingdingsCheckMark = "\xf0fe";
string wingdingsEmptyCheckbox = "\xf0a8";
string wordCertType1_ADT = wingdingsEmptyCheckbox;
string wordCertType2_Passport = wingdingsEmptyCheckbox;
string wordCertType3_Other = wingdingsEmptyCheckbox;
switch (certificateType)
{
    case 1:
        wordCertType1_ADT = wingdingsCheckMark;
        break;
    case 2:
        wordCertType2_Passport = wingdingsCheckMark;
        break;
    case 3:
        wordCertType3_Other = wingdingsCheckMark;
        break;
    default:
        wordCertType1_ADT = wingdingsCheckMark;
        break;
}
//then follow the normal mailmerge procedure on those 3 fields as
//doc1.MailMerge.Execute(new string[] { "adt", "passport", "other" }, new object[] { wordCertType1_ADT, wordCertType2_Passport, wordCertType3_Other });ref - build-table-from-datatable
 
				 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	