How can I keep a table together in a FlowDocument?

a 夏天 提交于 2019-12-05 02:40:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!