I don’t know the width of the texts in the textblock beforehand, and I want the the textblock to be aligned to the right like this, while still having the individual lines left-aligned:
Mr. Petersen |
Elmstreet 9 |
888 Fantastic City|
(| donotes the right edge of the document)
It should be simple, but I can’t figure it out.
I’ve tried to put all the text in a paragraph and set paragraph.Alignment = Element.ALIGN_RIGHT, but this will rightalign the individual lines.
I’ve tried to put the paragraph in a cell inside a table, and rightalign the cell, but the cell just takes the full width of the table.
If I could just create a container that would take only the needed width, I could simply rightalign this container, so maybe that is really my question.
Just set the
Paragraph.Alignproperty:It even works with a long string like this:
EDIT:
After looking at the “picture” you drew…
It doesn’t match with the title. The only way you can align individual
Paragraphobjects like your picture is if the “paragraph” does NOT exceed theDocumentobject’s “content” box (for a lack of a better term). In other words, you won’t be able to get that type of alignment if the amount of text exceeds that which will fit on a single line.With that said, if you want that type of alignment you need to:
Paragraphs.Something like this:
UPDATE 2:
After reading your updated question, here’s another option that lets you add text to the left side of the “container”: