//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();
Теперь я хочу знать, как поместить текст в заголовки и в каждую ячейку.
У вас есть идеи?
Я создал таблицу в RichTextBox следующим образом: [code]//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(); [/code] Теперь я хочу знать, как поместить текст в заголовки и в каждую ячейку. У вас есть идеи?