将表格保持为一体 MigraDoc / PDFsharp

发布于 2024-07-26 11:09:40 字数 421 浏览 2 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情丝乱 2024-08-02 11:09:40

您可以设置 Table RowKeepWith 属性来指定必须保持在一起的块。

如果您知道表格适合一页,则可以在表格完成后将第一行的 KeepWith 属性设置为 (table.Rows.Count - 1)

You can set the KeepWith property of a Table Row 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文