Issue with Colspan and HTML to PDF

I tried to convert a very simple HTML document to PDF and found that colspan makes the row height come out extremely wrong in the PDF. Output to RTF seems OK.

Document d = new Document(@"C:\Temp\T.html");
d.Save(@"C:\Temp\T.rtf");
d.Save(@"C:\Temp\T.pdf");

Attached is zip file with source and results

Hi

Thanks for your request. The problem occurs because when you convert HTML to DOC and there is table with rowspan or colspan Aspose.Words represents them as merged cells, but each of merged cell contains the same content. I linked your request to the appropriate issue. You will be notified as soon as it is resolved.
As a workaround, you can try using the following code:

Document doc = new Document(@"Test001\T.html");
RemoveContentFromMergedCells(doc);
doc.Save(@"Test001\out.pdf");
/// 
/// Remove content from merged cells.
///
public void RemoveContentFromMergedCells(Document doc)
{
    // Remove content from merged cells.
    // Get collection of cells in the docuemnt.
    NodeCollection cells = doc.GetChildNodes(NodeType.Cell, true);
    foreach(Cell cell in cells)
    {
        // Check whether cell is merged with previouse.
        if (cell.CellFormat.HorizontalMerge == CellMerge.Previous ||
            cell.CellFormat.VerticalMerge == CellMerge.Previous)
        {
            // Remove content from the cell.
            cell.RemoveAllChildren();
        }
    }
}

Hope this helps.
Best regards.

Thanks for the reply. The workaround solves some of it, but I still think there’s an issue. See the attached sample. It seems that if you use a mixture of colspan in the same table the borders and sizes get mixed up (in both PDF and RTF)

Hi

Thank you for additional information. I managed to reproduce the problem on my side. you will be notified as soon as they are fixed.
Best regards.

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

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

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

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

The issues you have found earlier (filed as WORDSNET-2553) have been fixed in this Aspose.Words for .NET 18.11 update and this Aspose.Words for Java 18.11 update.