PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon Jul 16, 2018 10:00 am

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
 Post subject: word wrap -MigraDoc
PostPosted: Mon Jul 21, 2008 10:49 am 
Offline

Joined: Sat Jul 19, 2008 6:35 pm
Posts: 1
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jul 21, 2008 1:54 pm 
Offline
empira Employee
User avatar

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

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: word wrap -MigraDoc
PostPosted: Mon Mar 01, 2010 5:34 am 
Offline

Joined: Mon Mar 01, 2010 5:30 am
Posts: 2
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


Top
 Profile  
Reply with quote  
 Post subject: Re: word wrap -MigraDoc
PostPosted: Mon Mar 01, 2010 9:20 am 
Offline
empira Employee
User avatar

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

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: word wrap -MigraDoc
PostPosted: Sun Mar 07, 2010 7:05 pm 
Offline

Joined: Mon Mar 01, 2010 5:30 am
Posts: 2
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


Top
 Profile  
Reply with quote  
 Post subject: Re: word wrap -MigraDoc
PostPosted: Wed Jun 30, 2010 10:12 pm 
Offline

Joined: Wed Jun 30, 2010 10:08 pm
Posts: 4
Did you ever find an answer to your text-wrapping question? How are you handling it?


Top
 Profile  
Reply with quote  
 Post subject: Re: word wrap -MigraDoc
PostPosted: Wed Nov 03, 2010 2:26 pm 
Offline

Joined: Thu Oct 16, 2008 1:54 pm
Posts: 14
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.


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: No registered users and 7 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