如何将多行文本粘贴到WPF RichTextBox作为单个段落?

时间:2013-12-30 10:00:37

标签: c# wpf richtextbox newline paragraph

假设我想在此文本中添加RichTextBox:

Text line 1
Text line 2
Text line 3

Paste()到RichTextBox时,它会将\n更改为Paragraph break,但我想将\n保留为换行符。我怎么能这样做?谢谢!

1 个答案:

答案 0 :(得分:0)

保留\r,删除\n

rtb.Selection.Text = Clipboard.GetText().Replace("\n", "");