I've changed your code to demonstrate even more what Eyal H has stated:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var table = new Table() { BorderThickness = new Thickness(1), BorderBrush = Brushes.Black, CellSpacing = 4 };
var rowGroup = new TableRowGroup();
var tableRow = new TableRow();
var cell1 = new TableCell() { RowSpan = 1, Background = Brushes.Red, BorderThickness = new Thickness(3, 3, 3, 3), BorderBrush = Brushes.Green };
var cell2 = new TableCell() { RowSpan = 1, Background = Brushes.Red, BorderThickness = new Thickness(2, 2, 2, 2), BorderBrush = Brushes.Blue };
var correctContent = "**************************************************************************************************************************************************************************************************************************************";
cell1.Blocks.Add(new Paragraph(new Run("Cell 1" + correctContent)));
cell2.Blocks.Add(new Paragraph(new Run("Cell 2" + correctContent.Replace("*"," ")+".")));
tableRow.Cells.Add(cell1);
tableRow.Cells.Add(cell2);
rowGroup.Rows.Add(tableRow);
table.RowGroups.Add(rowGroup);
var flowDocument = new FlowDocument();
flowDocument.Blocks.Add(table);
Content = flowDocument;
}
}
The Cell 2 has many spaces ending with a dot. Cell 1 fits on page 1 and an empty cell with no borders (and no colour) is placed on the second page. I was not able to find a property of any Table
or DocumentPaginator
object in the hierarchy that would deal with the page breaks within cells.
![Cell 1 made shorter](https://i.stack.imgur.com/8DR9W.png)
"Since the Cell2 is shorter than the page it does not split and therefore an "empty" cell is located at the second page (with no properties)"
Maybe it's time for a Connect article?