PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Jul 03, 2024 5:54 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Aug 10, 2015 2:20 pm 
Offline

Joined: Mon Aug 10, 2015 2:11 pm
Posts: 2
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


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 10, 2015 2:59 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 12, 2015 2:56 pm 
Offline

Joined: Mon Aug 10, 2015 2:11 pm
Posts: 2
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.


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 12, 2015 3:29 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
Nested tables can often be avoided by using MergeRight.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 12, 2015 2:21 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 41 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group