当我将RTF追加到"File Format is not valid"
richtextbox
public void Go()
{
rtb.Text = "Activated Partial Thromboplastin Time : Collected: 8/17/2012 9:06:00 AM\n";
rtb.Select(rtb.TextLength, 0);//sets the selection starting point as the end of this Rtb
rtb.SelectedRtf = @"{\trowd" +//ERROR thrown here
@"\cellx4000" +
@"\cellx9500" +
@"\intbl Activated Partial Thromboplastin Time\cell" +
@"\intbl 34.8 Seconds\cell" +
@"\row}";
}
如何将trowd
附加到我的RichTextBox?
答案 0 :(得分:2)
要插入rtf代码,它必须是完全独立的rtf文档,这意味着您的文本需要\rtf1{
标题和结束}
符号:
rtb.SelectedRtf = @"{\rtf1\ansi{\trowd" +//ERROR thrown here
@"\cellx4000" +
@"\cellx9500" +
@"\intbl Activated Partial Thromboplastin Time\cell" +
@"\intbl 34.8 Seconds\cell" +
@"\row}}";
请注意字符串的开头以及末尾的额外}
括号。