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

word wrap -MigraDoc
http://forum.pdfsharp.de/viewtopic.php?f=2&t=434
Page 1 of 1

Author:  charleslyk [ Mon Jul 21, 2008 10:49 am ]
Post subject:  word wrap -MigraDoc

Hi all, i am encountering problem with migradoc word wrapping in a tablecell when the word is very long and without any spaces.

(e.g http://www.xxxxxxxxxxx.com/aaaaaa/bbbbb ... ddddd.html)

So far my search has not turned out any way to resolve this. The closest i could get was to use PDFSharp "DrawString". However, i am unable to obtain a Graphics context to "DrawString" to.

Any help is greatly appreciated.

Charles

Author:  Thomas Hoevel [ Mon Jul 21, 2008 1:54 pm ]
Post subject: 

Hi!

It is by design that MigraDoc doesn't wrap words without hyphens or soft hyphens.

There is a simple solution: insert soft hyphens at the places where you want to allow wrapping to occur.
You can insert soft hyphens using Alt+0173 - e.g. behind every single forward slash and behind every dot.

Another idea: write "Click me", "Go to homepage", or another friendly name into the cell and hide the URL from the reader.
Use AddHyperlink from the Paragraph object.

Author:  wchan [ Mon Mar 01, 2010 5:34 am ]
Post subject:  Re: word wrap -MigraDoc

Hello, I'm a new user of MigraDoc and I am also coming across the same issue. Is there a way to not display the hyphen that gets automatically generated when a word is broken at a soft hyphen? Is there such a thing as a soft space? Thank you

Author:  Thomas Hoevel [ Mon Mar 01, 2010 9:20 am ]
Post subject:  Re: word wrap -MigraDoc

wchan wrote:
Is there a way to not display the hyphen that gets automatically generated when a word is broken at a soft hyphen?

I'm afraid this is not supported.

Author:  wchan [ Sun Mar 07, 2010 7:05 pm ]
Post subject:  Re: word wrap -MigraDoc

That's unfortunate. Is it possible to calculate how much of a word will fit into the width of the text area? I can then write some code to chop up the word myself.

Or another option, maybe I can customize the MigraDoc code to override the method that handles word wrapping. If you point me to where I should look, I can see what I can do and post the code back to you.

Thank you

Author:  935main [ Wed Jun 30, 2010 10:12 pm ]
Post subject:  Re: word wrap -MigraDoc

Did you ever find an answer to your text-wrapping question? How are you handling it?

Author:  RichardD [ Wed Nov 03, 2010 2:26 pm ]
Post subject:  Re: word wrap -MigraDoc

wchan wrote:
Is there a way to not display the hyphen that gets automatically generated when a word is broken at a soft hyphen?


If you comment out the body of the RenderSoftHyphen method in the ParagraphRenderer class (MigraDoc\code\MigraDoc.Rendering\MigraDoc.Rendering\ParagraphRenderer.cs, line 1083), that seems to work. Long words are still broken on the soft hyphen, but the hyphen character isn't rendered.

You'll need to turn of the "Treat warnings as errors" option to recompile the code, as v1.31 has several warnings for obsolete features. :roll:

It's possible that this change might break something else, but it seems to work for me.

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