views:

823

answers:

1

Hello!

I am using PDFsharp / MigraDoc's to write tables and chart's to PDF files. This worked great so far, however MigraDoc's 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's 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!

+2  A: 

Hi!

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.

The best place to ask PDFsharp and MigraDoc Foundation related questions is the PDFsharp forum. The PDFsharp Team will not monitor stackoverflow.com on a regular basis.

PDFsharp Forum:
http://forum.pdfsharp.net/

PDFsharp Team