locked
Justify all lines in FlowDocument paragraph RRS feed

  • Question

  • Hello,

    i have 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)

    If this could not be done with a straight forward way, could it be achieved through TextFormatter? FormattedText? Glyphs?

    Thanks, Sam

    Saturday, June 19, 2010 5:25 PM