Table width issue in the PDF documents

Hi Team,

We are encountering a table width issue in the PDF documents generated by Aspose. We have a template that contains a table, where some columns are dynamically removed during Word document generation. However, when converting the Word document to PDF, we’ve noticed that the width of one of the tables gets reduced however it set to 100 percent.

We’ve tried using the autofit property for the table via code, which resolved the problem in some cases. However, we continue to face table width issues in PDFs for other documents. We also tried using the “Update Layout” option, but this did not resolve the issue. The problem occurs intermittently, not every document.

Upon further investigation, we’ve observed that the tables with width issues have the “Automatically resize to fit contents” property checked. When we unchecked this property and regenerated the template, the PDF width issue was resolved.

Could you please confirm whether this property is causing the table width to shrink? Additionally, could you explain why the issue only occurs in PDFs and not in Word documents? If this is a limitation, is there a way to resolve it programmatically?

Looking forward to your insights.

I have attached the template , generated document and generated pdf document. you can found discrepancy between word and pdf document output.

FM test template.docx (43.6 KB)

FM test__FM test template_2025-03-25 (1).pdf (5.2 KB)

FM test__FM test template_2025-03-25.docx (31.5 KB)

below is code snippet to convert word to pdf document

using MemoryStream pdfDocStream = new();

 var pdfSaveOptions = new PdfSaveOptions();

 var wordDocumentToSave = (Document)wordDocument.Clone(true);

 try
 {
     wordDocument.Save(pdfDocStream, pdfSaveOptions);
 }
 catch
 {
     pdfDocStream.SetLength(0);
     pdfDocStream.Position = 0;
     wordDocumentToSave.Styles.DefaultParagraphFormat.ClearFormatting();
     wordDocumentToSave.Save(pdfDocStream, pdfSaveOptions);
 }

Screenshot 2025-04-03 203005.png (51.9 KB)

@rahulprajapati
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-28086

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.

Hi Team any update on above issue on Can we have workaround for the same?

@rahulprajapati We have completed analyzing the issue. The issue occurs because incorrect table column widths stored in the document are not recalculated by Aspose.Words.
The document appears to be generated by Aspose.Words. Incorrect column widths are stored in tblGrid element for the problematic tables.
The logic to re-calculate table layouts is being implemented per WORDSNET-832. Currently the logic is not applied to the problematic tables because content metrics for list label tabs with center alignment used in the document were not investigated, and the metrics are not considered reliable. Aspose.Words falls back to older table layout approach which mostly relies on tblGrid data which are incorrect in this case.

Postponing until the problematic tables are handled per WORDSNET-832.