【发布时间】:2022-05-05 20:02:35
【问题描述】:
我在richtextbox 中创建了一个表格,如下所示:
//Since too much string appending go for string builder
StringBuilder tableRtf = new StringBuilder();
//beginning of rich text format,dont customize this begining line
tableRtf.Append(@"{\rtf1 ");
//create 5 rows with 3 cells each
for (int i = 0; i < 5; i++)
{
tableRtf.Append(@"\trowd");
//A cell with width 1000.
tableRtf.Append(@"\cellx1000");
//Another cell with width 2000.end point is 3000 (which is 1000+2000).
tableRtf.Append(@"\cellx2000");
//Another cell with width 1000.end point is 4000 (which is 3000+1000)
tableRtf.Append(@"\cellx3000");
//Another cell with width 1000.end point is 4000 (which is 3000+1000)
tableRtf.Append(@"\cellx4000");
tableRtf.Append(@"\intbl \cell \row"); //create row
}
tableRtf.Append(@"\pard");
tableRtf.Append(@"}");
this.misc_tb.Rtf = tableRtf.ToString();
现在我想知道如何将文本放在标题和每个单元格中。
你有什么想法吗?
【问题讨论】:
标签: c# richtextbox rtf