Gap in table after converting from docx to pdf using Aspose.Words 8.0.0.0

Hi, could you take a look at the two attached documents? Thanks.

Hi,
Thanks for your inquiry. The problem occurs because there are few tables one by one in your document. I linked your request to the appropriate issue. You will be notified as soon as it is fixed.
I can suggest you two workarounds of this issue for now:

  1. You can insert an empty paragraph between table. Please see the following code:
// Open document.
Document doc = new Document(@"Test001\in.docx");
// Get collection of tables
NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
Paragraph spliter = new Paragraph(doc);
spliter.ParagraphBreakFont.Size = 1;
// loop through all tables
foreach(Table table in tables)
{
    // Check if the next node after the tabel is another table.
    // If so, insert an empty paragraph between tables.
    if (table.NextSibling != null && table.NextSibling.NodeType == NodeType.Table)
        table.ParentNode.InsertAfter(spliter.Clone(true), table);
}
// Save output document
doc.SaveToPdf(@"Test001\out.pdf");
  1. You can merge table into one table:
// Open document.
Document doc = new Document(@"Test001\in.docx");
// Get collection of tables
NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
Paragraph spliter = new Paragraph(doc);
spliter.ParagraphBreakFont.Size = 1;
// loop through all tables
foreach(Table table in tables)
{
    // Check if the next node after the tabel is another table.
    if (table.NextSibling != null && table.NextSibling.NodeType == NodeType.Table)
    {
        Table nextTable = (Table) table.NextSibling;
        // Append all rows form the current table to the next.
        while (table.HasChildNodes)
            nextTable.Rows.Insert(0, table.LastRow);
    }
}
// Save output document
doc.SaveToPdf(@"Test001\out.pdf");

Hope this helps.
Best regards,

The issues you have found earlier (filed as 9902) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(44)