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

Text Box Dimensions
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3735
Page 1 of 1

Author:  ErnstF [ Thu Feb 22, 2018 6:46 am ]
Post subject:  Text Box Dimensions

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

Author:  Thomas Hoevel [ Thu Feb 22, 2018 9:20 am ]
Post subject:  Re: Text Box Dimensions

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

Author:  ErnstF [ Thu Feb 22, 2018 1:27 pm ]
Post subject:  Re: Text Box Dimensions

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

Author:  Thomas Hoevel [ Thu Feb 22, 2018 2:41 pm ]
Post subject:  Re: Text Box Dimensions

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.

Author:  ErnstF [ Mon Mar 05, 2018 6:39 pm ]
Post subject:  Re: Text Box Dimensions

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

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