如何在 FlowDocument 中将表格保存在一起? [英] How can I keep a table together in a FlowDocument?
问题描述
我想如果我将表格放在一个段落中,我可以使用 KeepTogether 属性将表格保持在一起.该表用于报告的总计,客户不希望它们分成两页.设想!表中有 5 行,我快疯了,不知道下一步该尝试什么.
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.
最后一行代码:
myFlowDocument.Blocks.Add(footerParagraph);
footerParagraph 的输出以:
The output of footerParagraph begins with:
<Paragraph KeepTogether="True">
<Floater HorizontalAlignment="Center">
<Table CellSpacing="0" FontFamily="Arial" FontSize="14" Foreground="#FF000000">
KeepTogether 通常可以工作,但是当它包含 Floater 和 Table 时为什么不行呢?有解决方法吗?
KeepTogether ordinarily works, but why not when it contains a Floater and Table? Is there a workaround?
谢谢!
推荐答案
我遇到了类似的问题,您是否尝试过使用 Figure 而不是 Floater.对于我的,我需要将 Figure 的 CanDelayPlacement 设置为 false.
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.
这篇关于如何在 FlowDocument 中将表格保存在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!