Somehow like this
<
| Number | Duration | Call(s) | Cost |
<
>
I am able to replace the fields CustomerName, MobileNumber, BillPeriod, Date by using below code
foreach (Word.Field myMergeField in myWordDoc.Fields)
{
Word.Range rngFieldCode = myMergeField.Result;
String fieldText = rngFieldCode.Text;
if (fieldText.StartsWith(" MERGEFIELD"))
{
Int32 endMerge = fieldText.IndexOf("\\");
Int32 fieldNameLength = fieldText.Length - endMerge;
String fieldName = fieldText.Substring(11, endMerge - 11);
foreach (DataColumn dc in dt.Columns)
{
if (fieldName == dc.ColumnName)
{
myMergeField.Select();
myWordApp.Selection.TypeText(dt.Rows[0][dc.ColumnName].ToString());
}
}
}
}
But not able to fill the data in datatable, can someone please help me to fill the data in the table, please help me with C# code and the format I need to place in template file. Please avoid suggestion for tools like aspose etc.
But not able to fill the data in datatable, can someone please help me to fill the data in the table, please help me with C# code and the format I need to place in template file. Please avoid suggestion for tools like aspose etc.

Replies
Know the answer? Post it — somebody with the same question will find it here.