views:

178

answers:

1

Hello,

i have a some paragraphs within a FlowDocument, and what i need is to justify all lines (even lines with line breaks)

Here's a code sample:

 <Paragraph TextAlignment="Justify">
"One of the most important operations necessary when text materials
are prepared for printing or display is the task of dividing long
paragraphs into individual lines.<LineBreak/>
When this job has been done well,
people will not be aware of the fact that the words they are reading
have been broken apart arbitrarily and placed into a somewhat rigid
and unnatural rectangular framework; but if the job has been done
poorly, readers will be distracted by bad breaks that interrupt
their train of thought."
</Paragraph>

The output of the above will not justify the line that has a line break, this line will be aligned left, what i need is a same-width lines for all lines

How could this be achieved?

(Note that the desired output is the same output achievable in ms word if a paragraph has line breaks and is set to justify, for example if we have 3 words on a line we'll have 1 word on the left, one in the center and one on the right)

Thanks, Sam

A: 

I don't think you can achieve what you want. Even if you replace the <LineBreak/> with a close paragraph (which I know you don't want):

<Paragraph TextAlignment="Justify">
One of the most important operations necessary when text materials
are prepared for printing or display is the task of dividing long
paragraphs into individual lines.
</Paragraph>
<Paragraph TextAlignment="Justify">
When this job has been done well,
people will not be aware of the fact that the words they are reading
have been broken apart arbitrarily and placed into a somewhat rigid
and unnatural rectangular framework; but if the job has been done
poorly, readers will be distracted by bad breaks that interrupt
their train of thought.
</Paragraph>

the last line of the paragraph is left justified.

ChrisF
If above is not achievable, as an alternative i was thinking of manually justifying the text knowing the line break of each line, could this be achieved somehow? like setting a width and manual spacing for each line so that i get a justified paragraph?
sam