Reputation: 44295
I get an Error "File Format is not valid"
when I append RTF to a 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}";
}
How can I append a trowd
to my RichTextBox?
Upvotes: 1
Views: 928
Reputation: 81675
To insert your rtf code, it has to be a fully independent rtf document, which means you need the \rtf1{
header and a closing }
symbol to your text:
rtb.SelectedRtf = @"{\rtf1\ansi{\trowd" +//ERROR thrown here
@"\cellx4000" +
@"\cellx9500" +
@"\intbl Activated Partial Thromboplastin Time\cell" +
@"\intbl 34.8 Seconds\cell" +
@"\row}}";
Do note the beginning of the string and also the extra }
bracket at the end.
Upvotes: 2