I am trying to add a right border to a single MirgraDoc table column if the source column is frozen. This works fine, until I add a top border to my header row. As soon as I touch the border of the header row, all of the cells in the header row gain the right border from the "frozen" column. How can I keep the non-frozen columns from inheriting the right border setting?
Code:
for (int i = 0; i < sourceTable.Columns.Count; i++)
{
SourceColumn srcCol = sourceTable.Columns[i];
MigraDoc.DocumentObjectModel.Tables.Column column = table.AddColumn();
if (srcCol .IsHFrozen && !srcCol .NextVisibleColumn.IsHFrozen)
{
column.Borders.Right.Color = new MigraDoc.DocumentObjectModel.Color(blue.A, blue.R, blue.G, blue.B);
}
}
MigraDoc.DocumentObjectModel.Tables.Row headerRow = table.AddRow();
headerRow.HeadingFormat = true;
headerRow.Borders.Top.Color = new MigraDoc.DocumentObjectModel.Color(blue.A, blue.R, blue.G, blue.B);
headerRow.BottomPadding = 4;
int colIndex = 0;
double tableWidth = section.PageSetup.PageWidth.Point - section.PageSetup.LeftMargin.Point -
section.PageSetup.RightMargin.Point;
for (int i = 0; i < sourceTable.Columns.Count; i++)
{
SourceColumn srcCol = sourceTable.Columns[i];
String colName = srcCol.Name;
headerRow.Cells[colIndex].AddParagraph(colName);
double colPercent = gridCol.Width / (double)superGridControlData.Width;
headerRow.Cells[colIndex].Column.Width = Unit.FromPoint((colPercent*tableWidth)+10);
colIndex++;
}