Hi.
I’m trying to generate pdf from attached DOCX template.
To do it Im using Save(string fileName) method.
But after saving the pdf document doesn’t look like I expected.
There is a problem with dividing row in table. One data row is printed twice when it can’t be fitted at the end of page.
When I’m saving document as doc, it looks good.
I would be satisfied results from DOC but I need to save it as PDF or print it(print method).
Do you have any ideas to help me solve this problem?
CODE:
var doc = new Document(“Test.docx”);
var dataTable = new DataTable(“data”);
var dataColumn = new DataColumn(“description”, typeof(string));
dataTable.Columns.Add(dataColumn);
for (int i = 0; i < 20; i++)
{
DataRow dataRow = dataTable.NewRow();
dataRow[“description”] = string.Format("{0} - {1}", “Description”, i);
dataTable.Rows.Add(dataRow);
}
var dataSet = new DataSet();
dataSet.Tables.Add(dataTable);
doc.MailMerge.ExecuteWithRegions(dataSet);
var fieldNames = new String[]
{
“header” //1
,“dataheader” //2
,“sum” //3
};
var fieldValues = new Object[]
{
“header” //1
,“results” //2
,dataTable.Rows.Count //3
};
doc.MailMerge.Execute(fieldNames, fieldValues);
doc.Save(“Test.pdf”);
doc.Save(“Test.doc”);
Hi,