PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Mar 19, 2024 8:35 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
 Post subject: Text Box Dimensions
PostPosted: Thu Feb 22, 2018 6:46 am 
Offline

Joined: Thu Feb 22, 2018 6:15 am
Posts: 5
Location: Baden, Austria
Hello and good morning! :)

I started using PDFsharp and Migradoc a few days ago and so far - a great experience!
Now I ran into following issue:
I want to place 2 text frames into a table cell - one in the lower left corner, one opposite in the upper right
each of them shall contain a paragraph with a few words wrapped to a 3-line text

Now I need to know the dimensions of my tiny multiline textblocks.
Width is not a big thing - I can use gfx.MeasureString for individual lines.

but the height of a multiline text? - from my point of view it's a similar problem as in in recent post "How to get real row Height?"
(I would not mind to create a temporary migradoc document with a temporary table and render it)
Thomas stated in this post "You can get the real height from the Renderer after calling PrepareDocument."

Can someone help me out how to get the dimensions "from the renderer" ? :roll:

Thanks in advance and best regards


Top
 Profile  
Reply with quote  
 Post subject: Re: Text Box Dimensions
PostPosted: Thu Feb 22, 2018 9:20 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
Hi!

I would try to realize the document with just one table and without any TextFrame.
MigraDoc allows to create "jagged" tables using MergeRight and MergeDown, so as I understand your requirement it should be possible - maybe with some dummy columns and/or dummy rows for spacing or such.

As a hack you can determine the height using the XTextFormatterEx family of classes.
viewtopic.php?f=8&t=3192

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Text Box Dimensions
PostPosted: Thu Feb 22, 2018 1:27 pm 
Offline

Joined: Thu Feb 22, 2018 6:15 am
Posts: 5
Location: Baden, Austria
Thank you for your fast reply - I solved my problem now as you suggested with an extra row and an extra column and using mergedown/right.

One more question: I tried to use diagonal Borders by setting
Code:
<cell>.Borders.DiagonalDown.Visible = true

without any effect.

I then tried to use it on my table - no effect
setting
Code:
table.Format.Borders.DiagonalDown.Width = 0.2
does not help.

Can you please give me a hint what I am doing wrong?

Thanks in advance
Ernst


Top
 Profile  
Reply with quote  
 Post subject: Re: Text Box Dimensions
PostPosted: Thu Feb 22, 2018 2:41 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3092
Location: Cologne, Germany
I don't know if diagonal borders are implemented in the PDF renderer.

You can render the document to RTF instead of PDF - and if the diagonal borders show up there then most likely the implementation for PDF is missing.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Text Box Dimensions
PostPosted: Mon Mar 05, 2018 6:39 pm 
Offline

Joined: Thu Feb 22, 2018 6:15 am
Posts: 5
Location: Baden, Austria
Thomas! sorry for bothering you for nothing
Border.DiagonalDown is implemented in docRenderer and works fine.

my fault was in trying to activate it by
<cell>.Format.Borders.DiagonalDown.<setting>

instead of
<cell>.Borders.DiagonalDown.<setting>

Thank you
Ernst


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: Google [Bot] and 43 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