PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Question: MigraDoc force break paragraph in table
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3923
Page 1 of 1

Author:  NewUserHere [ Tue Mar 05, 2019 10:38 am ]
Post subject:  Question: MigraDoc force break paragraph in table

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)?

Author:  Thomas Hoevel [ Tue Mar 05, 2019 12:46 pm ]
Post subject:  Re: Question: MigraDoc force break paragraph in table

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.

Author:  NewUserHere [ Tue Mar 05, 2019 1:15 pm ]
Post subject:  Re: Question: MigraDoc force break paragraph in table

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?

Author:  Thomas Hoevel [ Tue Mar 05, 2019 2:38 pm ]
Post subject:  Re: Question: MigraDoc force break paragraph in table

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.

Author:  NewUserHere [ Tue Mar 05, 2019 4:21 pm ]
Post subject:  Re: Question: MigraDoc force break paragraph in table

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)

Author:  Thomas Hoevel [ Tue Mar 05, 2019 4:45 pm ]
Post subject:  Re: Question: MigraDoc force break paragraph in table

NewUserHere wrote:
How can I check whether the string fits into a table cell or not?
TextMeasurement class here:
viewtopic.php?p=9390#p9390

Author:  NewUserHere [ Wed Mar 06, 2019 9:52 am ]
Post subject:  Re: Question: MigraDoc force break paragraph in table

Thank you. Just if anyone is searching, I put the important part of my solution here: https://gist.github.com/SeppPenner/5bbe ... eebb324560

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