将表格保持为一体 MigraDoc / PDFsharp
我正在使用 PDFsharp / MigraDoc 将表格和图表写入 PDF 文件。 到目前为止效果很好,但是当 MigraDoc 将整个表格移动到文档中的下一页时,它总是会(垂直)分割我的表格。 如何确保桌子保持完整?
MigraDoc.DocumentObjectModel.Tables 的表类具有 bool KeepTogether 属性,但它似乎没有任何效果(设置为 true 或 false)。
有没有办法手动完成? 有什么方法可以“测量”距页面末尾的距离并将其与表格高度进行比较吗? (或了解表格是否会拆分的任何其他方式)
请注意,我是第一次使用 PDFsharp / MigraDoc。 如果有任何我应该知道的最佳实践,请告诉我。 如果有一些很好的示例(我在 PDFSharp 的主页上看到了这些示例,但仅此而已),我很想了解它们!
I am using PDFsharp / MigraDoc to write tables and charts to PDF files. This worked great so far, however MigraDoc will always split my tables (vertically) when it should move the whole table to the next page in the document. How do I make sure the table will stay in one piece?
Table class of MigraDoc.DocumentObjectModel.Tables has a bool KeepTogether property however it seems to have no effect (either set to true or false).
Is there a way to do it manually? Is there any way to "measure" the distance from the end of the page and compare it to tables height? (Or any other way of knowing wether the table will be split or not)
Please note that I am using PDFsharp / MigraDoc for the first time. If there are any best practices I ought to know, please let me know. If there are some good examples out there (I saw those on PDFSharp's home page, but that's about it) I'd love to know about them!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以设置 Table
Row
的KeepWith
属性来指定必须保持在一起的块。如果您知道表格适合一页,则可以在表格完成后将第一行的
KeepWith
属性设置为(table.Rows.Count - 1)
。You can set the
KeepWith
property of a TableRow
to specify blocks that must be kept together.If you know the table fits on one page, you can set the
KeepWith
property of the first row to(table.Rows.Count - 1)
when the table is finished.