我的表单(WinForm)中有一个富文本框。我用它来更新描述列。当我执行更新操作时,它会在末尾引入换行符/换行符。
如何以简单的方式避免这个换行符。是否需要通过代码处理或通过属性管理?
public MyDlg(string strXmlFile)
{
InitializeComponent();
strInputXmlFile = strXmlFile;
xmlDoc.Load(@"c:\temp\SBD_Input.xml");
node = xmlDoc.SelectSingleNode("//SBD/Description");
// Set the description into the rich text box.
richTextBox1.AppendText(node.InnerText);
}
private void UpdateBtn_Click(object sender, EventArgs e)
{
// Put the RTB contents back into node & Import.
node.InnerText = richTextBox1.Text;
xmlDoc.ImportNode(node, true);
// Save the Xml document.
xmlDoc.Save(@"c:\temp\SBD_Input.xml");
this.Close();
}
输入 XML 文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<SBD>
<Number> 1234567</Number>
<Description>EDGES MAY BE BROKEN
All surfaces are varnished
--------------------
Color | R | G | B |
--------------------
as dflkjaslödfj lasöj flöaskj flaksjd fölkasjd flöaskjdf
askjflj asld fjklöaskjdf laskjfl s falsj flöasjkd f flaskjdf a
as djflajs dfl
</Description>
</SBD>