Docx joining two tables and saving to PDF changes border style

Using Aspose.Words 14.10 and the attached document with the included code (modified from your samples)…when I merge two tables and save to PDF, the border styles mess up/change. Specifically, the second table which has no border style, ends up with a full border. What is interesting is that if I uncomment the two lines of code that save to docx and reload the document, then it works just fine, but I’d rather not incur that performance cost. Any hints/tips/tricks?

Document doc = new Document("Table.Document.docx");
// Get the first and second table in the document.
// The rows from the second table will be appended to the end of the first table.
Table firstTable = (Table)doc.GetChild(NodeType.Table, 0, true);
Table secondTable = (Table)doc.GetChild(NodeType.Table, 1, true);
// Append all rows from the current table to the next.
// Due to the design of tables even tables with different cell count and widths can be joined into one table.
while (secondTable.HasChildNodes)
    firstTable.Rows.Add(secondTable.FirstRow);
// Remove the empty table container.
secondTable.Remove();
// doc.Save("Table.CombineTables Out.docx");
// doc = new Document("Table.CombineTables Out.docx");
doc.Save("Table.CombineTables Out.pdf");

Hi Colton,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 14.10.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-11049. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Thanks Awais,

I have done some further exploration and found the following workaround that I will be using in the meantime:

while (secondTable.HasChildNodes)
{
    Row row = secondTable.FirstRow;
    LineStyle style = row.RowFormat.Borders.LineStyle;
    firstTable.Rows.Add(row);
    firstTable.LastRow.RowFormat.Borders.LineStyle = style;
}

For some reason, after adding the row from the second table to the first table, the LineStyle changes from LineStyle.None to LineStyle.Single… doing this sets it back.

Hi Colton,

Thanks for the additional information. It is great you were able to find a workaround. However, we will keep you informed of any developments and let you know once this issue is resolved.

Best regards,