Free Support Forum - aspose.com

Differences between .pdf and .docx file - Aspose.Words - save method

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,


Thanks for your inquiry. Perhaps you’re using an older version of Aspose.Words; as with Aspose.Words for .NET version 13.2.0, I was unable to reproduce this issue on my side. I would suggest you please upgrade to the latest version of Aspose.Words 13.2.0. You can download it from here:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

Moreover, I have attached the PDF document that is generated on my side here for your reference.

Best regards,