PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
MigraDoc - KeepWithNext on Table followed by Paragraph https://forum.pdfsharp.net/viewtopic.php?f=2&t=3163 |
Page 1 of 1 |
Author: | afmab [ Mon Aug 10, 2015 2:20 pm ] |
Post subject: | MigraDoc - KeepWithNext on Table followed by Paragraph |
Hi, I have a scenario where I need to display a Table followed by a Paragraph and ensure that the two elements don't get separated by a page break. I am using MigraDoc v1.50 beta, and I know that this version fixes a similar bug so that a Paragraph followed by a Table with KeepWithNext set to true will now work, but I can't seem to get it to work the other way around. Is this not supported at the moment? Thanks |
Author: | Thomas Hoevel [ Mon Aug 10, 2015 2:59 pm ] |
Post subject: | Re: MigraDoc - KeepWithNext on Table followed by Paragraph |
Hi! afmab wrote: Is this not supported at the moment? I don't know. If you say it doesn't work then maybe it is not implemented or there is a bug.Maybe you can use a simple workaround: add the paragraph to the table and set KeepWith=1 for the row before the paragraph. You can use MergeRight to have the paragraph span several columns - and without table borders and background color it will look like an ordinary paragraph. |
Author: | afmab [ Wed Aug 12, 2015 2:56 pm ] |
Post subject: | Re: MigraDoc - KeepWithNext on Table followed by Paragraph |
Thanks for your quick response, I've gone with the approach you suggested. I'd simplified the scenario in my original post, so it's actually a bit more complicated. It's a table (with two columns and no borders - to create a two-column section), followed by a paragraph (a heading), followed by another table (again, one that creates a two-column section). And I need to ensure that all of the above don't get split by a page break. Which made it tricky to do as you suggested as it meant having a nested table, so I had to use the approach mentioned here as a workaround for that. Unfortunately this nested table also needed to be indented, but Rows.LeftIndent didn't seem to work when using the above method so I had to add an empty column as the workaround for the indent. So it's a bit messy, but it seems to be working. If KeepWithNext could work for tables with a trailing paragraph though then that'd make things a lot easier. Thanks. |
Author: | Thomas Hoevel [ Wed Aug 12, 2015 3:29 pm ] |
Post subject: | Re: MigraDoc - KeepWithNext on Table followed by Paragraph |
Nested tables can often be avoided by using MergeRight. |
Author: | Thomas Hoevel [ Thu Nov 12, 2015 2:21 pm ] |
Post subject: | Re: MigraDoc - KeepWithNext on Table followed by Paragraph |
Tables do not have a KeepWithNext property. So it's not a bug, it's a feature. And my suggested "workaround" is no workaround, it is a possible solution. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |