Hello,
I am creating a table using row and column continuation and have come across something that I can't quite figure out.
Currently I create my table as follows:
/// <summary>
/// Creates a generic table
/// </summary>
/// <returns>Table2 object</returns>
private Table2 CreateTable(ILayout layout)
{
// Instantiate table
Table2 tbl = new Table2(0, 0, layout.TableWidth, layout.PageHeight);
// Add columns to main table
foreach (KeyValuePair<string, float> kvp in HeaderColumns)
{
tbl.Columns.Add(kvp.Value);
}
// Set column header repeat count to 1 to repeat top header row
tbl.RepeatColumnHeaderCount = 1;
// Set border and border color
tbl.Border.Width = 0.5f;
tbl.Border.Color = new WebColor("#666666");
return tbl;
}
Next, I add a number of rows with the following code:
/// <summary>
/// Creates a row with therapy class data
/// </summary>
/// <returns>Row2 object</returns>
private void CreateTherapyClassRow(Row2 row, TherapyClass therapyClass, bool isContinuation)
{
WebColor bgColor1 = new WebColor("#333333");
WebColor bgColor2 = new WebColor("#777777");
// Instantiate row
string text = "<font color='white'><b>" + therapyClass.Name + "</b></font>";
if (isContinuation)
text = "<font color='white'><b>" + therapyClass.Name + " (continued)</b></font>";
// Create cell and add to row
Cell2 c = row.Cells.Add(CreateFormattedTextArea(text, Layout.TableWidth, false, 0));
c.BackgroundColor = (therapyClass.ParentID == -1) ? bgColor1 : bgColor2;
c.Padding = m_Padding;
c.VAlign = VAlign.Center;
c.Align = TextAlign.Left;
c.ColumnSpan = 3;
}
When viewing this, my table has an outside border as expected, but the internal cells have borders that look fine except at the top, left, right, and bottom of the main (outside) table.
The top left Therapy Class cell in the table has two borders, 1 on the outside and 1 a few units in on the top, left, and right sides. The next row looks fine with the border matching up, however again on the left and right sides there are double borders.
I've stripped out all of my code down to only creating the table, and adding the therapy class rows as shown above and I can't figure out how to fix the issue. I've also changed the background color of the cells to see if the coloring extends to the innermost borders, or all the way out, and the coloring indeed extends all the way to the outermost borders of the table.
Below is an approximation of what is happening. The plus (+) signs extend the border in all directions to the closest border.
---------------------------------------
|+-----------------------------------+|
|| ||
|| ||
|| ||
---------------------------------------
|| ||
|| ||
|| ||
+-------------------------------------+
Any ideas?