3

我在 FlowDocument 中有一些段落,我需要证明所有行(即使是带有换行符的行)

这是一个代码示例:

 <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>

上面的输出不能证明有换行符的行,这条线将左对齐,我需要的是所有行的宽度相同

这怎么可能实现?

(请注意,如果段落有换行符并设置为对齐,则所需的输出与 ms 字中可实现的输出相同,例如,如果我们在一行上有 3 个单词,我们将在左侧有 1 个单词,在中间有一个单词和一个在右边)

谢谢,山姆

4

2 回答 2

1

我不认为你能达到你想要的。即使你<LineBreak/>用一个关闭的段落替换(我知道你不想要):

<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>

该段落的最后一行左对齐。

于 2010-04-27T20:58:46.360 回答
0

这是你可能想要做的:

<Paragraph Margin="5,5,5,5"> <!--You can assign margin here or below to give you the spacing needed-->
<!--You can set width as need, but new line can be done in a textblocks LineBreak-->
<TextBlock TextAlignment ="Justify" TextWrapping="Wrap" Width="150"> 
    One of the most <LineBreak/>important operations necessary when text materials 
    are prepared for printing or display is the task of dividing long
    paragraphs into individual lines.
</TextBlock>                               

希望有帮助...

于 2017-01-10T19:28:37.990 回答