How can I keep a table together in a FlowDocument?

2019-03-31 21:18发布

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条回答
疯言疯语
2楼-- · 2019-03-31 22:04

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.

查看更多
登录 后发表回答