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

Left aligned text but right aligned to page
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3915
Page 1 of 1

Author:  fradax [ Sun Feb 17, 2019 2:12 pm ]
Post subject:  Left aligned text but right aligned to page

Hi all,
I'm not able to reproduce the layout shown in the picture (borders shown only for clarity). I have an address which must be left aligned, but it should be always aligned "as a frame" to the right of the page, e.g. its longest line must finish exactly at the right edge of the page. In the picture there are three examples; every address is left aligned but it starts at a different point.

Should I calculate exactly how long my text would be and then create a text frame or column with the calculated width? It seems too complicated, maybe I don't know some alignment options.

Thanks in advance,
David

Attachments:
migradoc.jpg
migradoc.jpg [ 52.86 KiB | Viewed 3648 times ]

Author:  TH-Soft [ Sun Feb 17, 2019 3:20 pm ]
Post subject:  Re: Left aligned text but right aligned to page

Hi!
fradax wrote:
Should I calculate exactly how long my text would be and then create a text frame or column with the calculated width?
That's the way to do it.
There is no "Auto" width with MigraDoc.

Author:  fradax [ Sun Feb 17, 2019 5:05 pm ]
Post subject:  Re: Left aligned text but right aligned to page

TH-Soft wrote:
Hi!
fradax wrote:
Should I calculate exactly how long my text would be and then create a text frame or column with the calculated width?
That's the way to do it.
There is no "Auto" width with MigraDoc.


Thanks, so the only way is to include the TextMeasurement class you provided in this topic: viewtopic.php?f=8&t=3196. Right?

Author:  TH-Soft [ Sun Feb 17, 2019 7:57 pm ]
Post subject:  Re: Left aligned text but right aligned to page

fradax wrote:
Thanks, so the only way is to include the TextMeasurement class you provided in this topic: viewtopic.php?f=8&t=3196. Right?
That would be my approach.
Simple if there only is one style per line. Things will become more difficult if you mix several styles (e.g. regular and bold), different fonts or font sizes in one of those lines.

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