PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Can a table be moved to a new page only if does not fit?
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4561
Page 1 of 1

Author:  anxytee [ Sun Mar 10, 2024 1:10 pm ]
Post subject:  Can a table be moved to a new page only if does not fit?

I'm trying to create a table (3 or 4 rows) which will be added after another table but if this new table doesn't entirely fit in the remaining spaces in that page then it should move to the next page.
I've tried using
Code:
myTab2.Format.KeepTogether = true;
but that doesn't work.

Author:  TH-Soft [ Sun Mar 10, 2024 1:44 pm ]
Post subject:  Re: Can a table be moved to a new page only if does not fit?

Set "KeepWith" for the first row of the table. If the table has four rows, set KeepWith to 3.

Author:  anxytee [ Sun Mar 10, 2024 3:48 pm ]
Post subject:  Re: Can a table be moved to a new page only if does not fit?

THANKS @TH-Soft. I did
Code:
myTab.Rows[0].KeepWith = myTab.Rows.Count - 1;
doc.LastSection.Add(myTab);


So far, seems to do the job :D But needs further testing

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/