I have a table which I am printing. I have added borders to all the cells but I have a problem when the table enters/exits a new page. Then the border is moved/stays at the page depending on the available space each cell is consuming. Is it possible to make this row dependent in sted?
Here is a picture of the problem

The gray line is the page shift.
Here is how I have done
foreach (Task task in TasksToShow)
{
myTable.RowGroups[0].Rows.Add(new TableRow());
currentRow = myTable.RowGroups[0].Rows[rowCount++];
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.TaskID.ToString()))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.TaskName))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.TaskResponsible))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.TaskResponsibleDepartment))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.Category))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.Status))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.Priority.ToString()))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.StartDate.ToString("dd/MM/yy")))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.ActualHours.TotalHours.ToString() + "h"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.EstimatedHours.TotalHours.ToString() + "h"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.EstimatedDeploymentDate.ToString("dd/MM/yy")))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.DesiredImplementationDate.ToString("dd/MM/yy")))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.APP.StartDate.ToString("dd/MM/yy")))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.APP.EstimatedHours.TotalHours.ToString() + "h"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.APP.ActualHours.TotalHours.ToString() + "h"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.IN.StartDate.ToString("dd/MM/yy")))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.IN.EstimatedHours.TotalHours.ToString() + "h"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.IN.ActualHours.TotalHours.ToString() + "h"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.SIS.StartDate.ToString("dd/MM/yy")))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.SIS.EstimatedHours.TotalHours.ToString() + "h"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.SIS.ActualHours.TotalHours.ToString() + "h"))));
currentRow.Cells.Add(new TableCell(new Paragraph(new Run(task.Tags))));
currentRow.FontSize = 10;
currentRow.FontWeight = FontWeights.Normal;
for (int n = 0; n < currentRow.Cells.Count; n++ )
{
currentRow.Cells[n].BorderThickness = new Thickness(1, 1, 1, 1);
currentRow.Cells[n].BorderBrush = Brushes.Black;
}
}
Also is there a way to make the cells width dependent on the largest cell and not just making all cells the same width?
Hope you can help.
I have figure out a solution which at least make it looks the same all the way through but I am not fully satisfied with it yet. I have just changed the thikness in the last for loop into this: