|
10 | 10 | IWSection section = document.LastSection; |
11 | 11 | //Get the first table in the section. |
12 | 12 | WTable table = section.Body.Tables[0] as WTable; |
13 | | - //Access the specific cells by their indices. |
| 13 | + //Access the instance of the cell (second row, second cell). |
14 | 14 | WTableCell cell1 = table[1, 1]; |
| 15 | + //Access the instance of the cell (third row, third cell). |
15 | 16 | WTableCell cell2 = table[2, 2]; |
16 | | - //Clear the contents of the first cell. |
| 17 | + //Clear the contents of the cell (second row, second cell). |
17 | 18 | cell1.ChildEntities.Clear(); |
18 | | - //Add a new paragraph with content to the first cell. |
| 19 | + //Add a new paragraph with content to the cell (second row, second cell). |
19 | 20 | cell1.AddParagraph().AppendText("Adventure"); |
20 | | - //Clear the contents of the second cell. |
| 21 | + //Clear the contents of the cell (third row, third cell). |
21 | 22 | cell2.ChildEntities.Clear(); |
22 | | - //Add a new paragraph with content to the second cell. |
| 23 | + //Add a new paragraph with content to the cell (third row, third cell). |
23 | 24 | cell2.AddParagraph().AppendText("Cycle"); |
24 | 25 | //Save the modified document. |
25 | 26 | using (FileStream outputFileStream = new FileStream(Path.GetFullPath("Output/Result.docx"), FileMode.Create, FileAccess.Write)) |
|
0 commit comments