The exporting in pdf generates a different table than the one in word

I have a similar problem. I have upgrade to Aspose 25.10 and the problem is still not solved. The exporting in pdf generates a different table than the one in word. If I save in PDF using the Word application the pdf is exported ok.

I have attached the word document that was exported with Aspose.Words.
DLA_DunningLetter_Exported.docx (818.1 KB)

@lanton The problem is not reproducible on my side using the latest 25.11 version of Aspose.Words and the following simple code:

Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.pdf");

Here is the output produced by Aspose.Words: out.pdf (44.3 KB)

Here is the output produced by MS Word on my side: ms.pdf (117.1 KB)

As I can see output PDF document produced by Aspose.Words and MS Word on my side look the same.

Could you please attach the problematic output document produced on your side for our reference?

Hi @alexey.noskov, doing this also work on my side. It seems the issue is related with how I build the Aspose in memory Document object. I am processing a template and creating programmatically the two tables that look like one table in the final document.

Saving the Document in both in word and pdf produces different results. It helps if I give you a small app that will reproduce the problem?

@lanton Yes, please create a simple console application that will allow us to reproduce the problem. We will check it on our side and provide you more information.

AsposeWordIssue.zip (1016.3 KB)

I have attached a console application that mimicks the way we create tables in word documents using Aspose. The final Document object is saved as both a word file and a pdf file.

@lanton Tank you for additional information. I have managed to reproduce the problem on my side with the following simplified code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToDocumentEnd();

// First table
Table t1 = builder.StartTable();
for (int i = 0; i < 3; i++)
{
    Cell cell1 = builder.InsertCell();
    cell1.CellFormat.Width = 70;
    builder.Write("test");

    Cell cell2 = builder.InsertCell();
    cell2.CellFormat.Width = 185.35;
    builder.Write("test");

    Cell cell3 = builder.InsertCell();
    cell3.CellFormat.Width = 70;
    builder.Write("test");

    Cell cell4 = builder.InsertCell();
    cell4.CellFormat.Width = 120;
    builder.Write("test");

    builder.EndRow();
}
builder.EndTable();
t1.AllowAutoFit = true;

// Second table
Table t2 = builder.StartTable();
Cell cell21 = builder.InsertCell();
cell21.CellFormat.Width = 325.35;
builder.Write("test");

Cell cell22 = builder.InsertCell();
cell22.CellFormat.Width = 120;
builder.Write("test");

builder.EndRow();
builder.EndTable();
t2.AllowAutoFit = true;

doc.Save(@"C:\Temp\out.pdf");
doc.Save(@"C:\Temp\out.docx");

If change document saving order the table is rendered properly in both documents. As a temporary workaround you can save document as DOCX first and then save it as PDF.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28849

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you very much

1 Like