1

"File Format is not valid"RTF 附加到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}";
}

如何将 a 添加trowd到我的 RichTextBox?

4

1 回答 1

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}}";

请注意字符串的开头以及}末尾的额外括号。

于 2012-12-19T20:06:49.223 回答