■ TableRow 클래스의 Cells 속성을 사용해 셀 속성을 설정하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
using System.Windows; using System.Windows.Documents; using System.Windows.Media; Table table = new Table(); for(int i = 0; i < 4; i++) { table.RowGroups.Add(new TableRowGroup()); } TableRowGroup tableRowGroup = table.RowGroups[0]; for(int i = 0; i < 10; i++) { tableRowGroup.Rows.Add(new TableRow()); } TableRow tableRow = tableRowGroup.Rows[0]; for(int i = 0; i < 10; i++) { tableRow.Cells.Add(new TableCell(new Paragraph(new Run("Cell " + (i + 1))))); } tableRow.Cells[0].Background = Brushes.PapayaWhip; tableRow.Cells[1].FontStyle = FontStyles.Italic; tableRow.Cells[2].Blocks.Clear(); |