问题
I thought if I place the Table in a Paragraph that I could use the KeepTogether attribute to keep the table together. The table is used for the totals of a report and the client does not want them broken over two pages. Imagine that! There are 5 rows in the table and I am going crazy not knowing what to try next.
Last line of code:
myFlowDocument.Blocks.Add(footerParagraph);
The output of footerParagraph begins with:
<Paragraph KeepTogether="True">
<Floater HorizontalAlignment="Center">
<Table CellSpacing="0" FontFamily="Arial" FontSize="14" Foreground="#FF000000">
KeepTogether ordinarily works, but why not when it contains a Floater and Table? Is there a workaround?
Thanks!
回答1:
I had a similar issue, have you tried using a Figure instead of a Floater. For mine I needed to set the Figure's CanDelayPlacement to false.
来源:https://stackoverflow.com/questions/12397089/how-can-i-keep-a-table-together-in-a-flowdocument