FlowDocument的强制分页符(BreakPageBefore) [英] FlowDocument Force a PageBreak (BreakPageBefore)

查看:715
本文介绍了FlowDocument的强制分页符(BreakPageBefore)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用C#创建一个的FlowDocument和一个表中的数据填充它。

I'm using C# to create a FlowDocument and fill it with data within a table.

示例:

FlowDocument flowDoc = new FlowDocument();
Table table1 = new Table();
flowDoc.Blocks.Add(table1); 

table1.RowGroups.Add(new TableRowGroup());
table1.RowGroups[0].Rows.Add(new TableRow());
TableRow currentRow = table1.RowGroups[0].Rows[0];
table1.RowGroups[0].Rows.Add(new TableRow());

currentRow = table1.RowGroups[0].Rows[0];
currentRow.Cells.Add(new TableCell(new Paragraph(new Run("Report"))));

我希望能够数据的每一个节后强制分页符。 我发现的 BreakPageBefore 的,但无法弄清楚如何强制分页符。

I want to be able to force a page break after every 'section' of data. I have found the BreakPageBefore but cant figure out how to force a Page Break.

任何例子是太棒了!

感谢。

推荐答案

如果我理解正确的,你想这样做:

If I understand right you want to do this:

Section section = new Section();
section.BreakPageBefore = true;
section.Blocks.Add(table1);
flowDoc.Blocks.Add(section);

如果你想要一个表,我建议最好还是做一个新的表内突破

If you want to break within a table i suggest it would be better to make a new table.

这篇关于FlowDocument的强制分页符(BreakPageBefore)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆