Free Support Forum - aspose.com

Unexpected results changing cell borders in Aspose.Pdf.Table

We are importing a DataTable into an Aspose Table.

We can then set the border for the whole table like this, which works fine:

m_Table.DefaultCellBorder = New BorderInfo(Fix(BorderSide.All), 1.0F)
m_Table.Border = New BorderInfo(Fix(BorderSide.All), 1.0F)

However, now we want to have a THICKER line below SOME cells. I am using code like this as I run through each row of the aspose table:

If rowNumber = 11 Then
cell.Border = New BorderInfo(Fix(BorderSide.Bottom), 2.0F)
cell.Border = New BorderInfo(Fix(BorderSide.Top), 1.0F)
cell.Border = New BorderInfo(Fix(BorderSide.Left), 1.0F)
cell.Border = New BorderInfo(Fix(BorderSide.Right), 1.0F)
End If
If rowNumber = 12 Then
cell.Border = New BorderInfo(Fix(BorderSide.Bottom), 1.0F)
cell.Border = New BorderInfo(Fix(BorderSide.Left), 1.0F)
cell.Border = New BorderInfo(Fix(BorderSide.Right), 1.0F)
cell.Border = New BorderInfo(Fix(BorderSide.Top), 2.0F)
End If

This particular code above produces a thick line at the bottom of row 11, no TOP line on row 11 (why not?), no LEFT line in the first cell on either line (why not?).

I have tried at least 7 variations on this code above, all with surprising results. It seems like some settings are cancelling others out or even combining their results e.g. with binary addition to produce unpredictable effects.

What am I doing wrong? Is there any rules of thumb for changing the borders of individual cells in an Aspose table? Are there any rules on conflicting settings, e.g. default table cell settings vs. BOTTOM of row 11 vs. TOP of row 12?

Thanks,

Edward

Dear Edward,

Thank you for considering Aspose.

Please refer to thread table borders in pdf.