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

Working with KeepWith
http://forum.pdfsharp.com/viewtopic.php?f=2&t=1283
Page 1 of 1

Author:  Craigbnz [ Thu Jul 29, 2010 8:09 pm ]
Post subject:  Working with KeepWith

Hi Guys,

I’ve been using MigraDoc to create PDF’s for just over a week now. It’s a great product and I think I’m pretty much up to speed now but I just can quite figure out how to solve one particular problem.
We have a section of our document which lists all the guarantors on the agreement, after all guarantors are listed we have a Witness box.
I want to keep the witness box with the guarantors but there is the possibility that we might have more guarantors than can fit on one page. Also if I have some room left from the previous blocks and the guarantor and witness box will fit within that space then I want to put it there. I.e. There is no page break before the guarantors.

The examples below might explain it more clearly. I can get E.g. 1 and E.g. 2 below to work by putting a keep with on the Rows i.e. row[0].keepwith = table.rows.count-1. However when it comes to case 3 it truncates the table.

What’s the best way to resolve this?

Do I need to figure out the max number I can fit on a page and only apply the keep with up to that number of rows?

By way of example.
E.g. 1 keep all on same page
Some other section
Some other Section
Gtr 1
Gtr 2
Witness

E.g. 2 Automatically break before Gtr1
Some other section
Some other section
Some other section
Some other section
Some other section
<<Migradoc to auto break here>>
Gtr1
Gtr2
Gtr3
Witness

E.g. 3 – More guarantors than can fit on a page.
Gtr1
Gtr2
Gtr3
Gtr4
<<migradoc to auto break>>
Gtr5
Gtr6
Gtr7
Witness

Author:  Craigbnz [ Thu Jul 29, 2010 8:52 pm ]
Post subject:  Re: Working with KeepWith

Hi Guys,

I have changed the code so that I only do the keep with for the first 4 entries. I.e. I know I can fit 4 items on a page, so when I hit the fourth item I set the KeepWith on the first row to be with the fourth row. I.e. row[0].KeepWith = 3;
However this doesn't work, it still tries to put all items in the table on a single page, and therefore truncates anything which doesn't fit.

Author:  () => true [ Sun Aug 08, 2010 8:45 am ]
Post subject:  Re: Working with KeepWith

If you send us a MDDDL file, I'll have a look after our holidays.

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