PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 5:48 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Tue Mar 05, 2019 10:38 am 
Offline

Joined: Tue Mar 05, 2019 10:33 am
Posts: 7
Is it possible to tell MigraDoc to break paragraphs in a table at a certain char, e.g. a comma?

Or is there some option to force a break of the paragraph if the paragraph is too long for the cell (Even if this might be in the middle of some text)?


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 05, 2019 12:46 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Maybe I do not get your point.

MigraDoc breaks lines at spaces, hyphens, soft-hyphens, and zero-width non-joiners.

A comma will typically be followed by a blank and MigraDoc will break at the blank and after the comma. Nothing to do here in the normal case.

Insert soft-hyphens or zero-width non-joiners at locations where you want to allow line breaks.

Insert line breaks to force line breaks.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 05, 2019 1:15 pm 
Offline

Joined: Tue Mar 05, 2019 10:33 am
Posts: 7
Quote:
Maybe I do not get your point.

MigraDoc breaks lines at spaces, hyphens, soft-hyphens, and zero-width non-joiners.

A comma will typically be followed by a blank and MigraDoc will break at the blank and after the comma. Nothing to do here in the normal case.

Insert soft-hyphens or zero-width non-joiners at locations where you want to allow line breaks.


I know about that. The problem is that I have a very long base64 encoded signature value in one cell or some log messages that do not necessarily contain any of the mentioned characters.

Quote:
Insert line breaks to force line breaks.


So the solution is to insert some
Code:
Environment.NewLine
s after e.g. 30 chars to force breaking of the string?


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 05, 2019 2:38 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
NewUserHere wrote:
I know about that. The problem is that I have a very long base64 encoded signature value in one cell or some log messages that do not necessarily contain any of the mentioned characters.
You missed the point that you have to insert soft-hyphens, zero-width non-joiners or maybe blanks at suitable locations.

NewUserHere wrote:
So the solution is to insert some
Code:
Environment.NewLine
s after e.g. 30 chars to force breaking of the string?
As an alternative you can insert soft-hyphens after 4 or 8 or so characters.

If you insert linebreaks after groups of 30 characters, make sure that 30 characters fit in a single line.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 05, 2019 4:21 pm 
Offline

Joined: Tue Mar 05, 2019 10:33 am
Posts: 7
Quote:
You missed the point that you have to insert soft-hyphens, zero-width non-joiners or maybe blanks at suitable locations.

I already thought about that.

Quote:
As an alternative you can insert soft-hyphens after 4 or 8 or so characters.

Probably not, I do prefer blanks in that case.

Quote:
If you insert linebreaks after groups of 30 characters, make sure that 30 characters fit in a single line.

How can I check whether the string fits into a table cell or not? Do you have some reference script for doing that in MigraDoc?

By the way, thank you for your time 8)


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 05, 2019 4:45 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
NewUserHere wrote:
How can I check whether the string fits into a table cell or not?
TextMeasurement class here:
viewtopic.php?p=9390#p9390

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 06, 2019 9:52 am 
Offline

Joined: Tue Mar 05, 2019 10:33 am
Posts: 7
Thank you. Just if anyone is searching, I put the important part of my solution here: https://gist.github.com/SeppPenner/5bbe ... eebb324560


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 117 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