Skip to content

Commit c9f3deb

Browse files
committed
Addressed the feedback
1 parent 3aa6fb6 commit c9f3deb

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

  • Tables/Cloned-and-add-table-row-with-restart-numbered-list/.NET/Cloned-and-add-table-row-with-restart-numbered-list

Tables/Cloned-and-add-table-row-with-restart-numbered-list/.NET/Cloned-and-add-table-row-with-restart-numbered-list/Program.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ public static void Main(string[] args)
1010
WordDocument document = new WordDocument(Path.GetFullPath(@"Data\Input.docx"));
1111
// Retrieve the first table from the last section of the document
1212
WTable table = (WTable)document.LastSection.Tables[0];
13-
// Clone the third row (index 2) of the table
14-
WTableRow clonedRow = table.Rows[2].Clone();
15-
// Insert the cloned row back into the table at position 3 (after the original row)
16-
table.Rows.Insert(3, clonedRow);
17-
// Iterate through all cells in the newly inserted row (row index 3)
18-
foreach (WTableCell cell in table.Rows[3].Cells)
13+
// Clone the second row (index 1) of the table
14+
WTableRow clonedRow = table.Rows[1].Clone();
15+
// Insert the cloned row back into the table at position 2 (after the original row)
16+
table.Rows.Insert(2, clonedRow);
17+
// Iterate through all cells in the newly inserted row (row index 2)
18+
foreach (WTableCell cell in table.Rows[2].Cells)
1919
{
2020
// Flag to track whether the first list paragraph has been encountered
2121
bool isListStart = false;
@@ -32,7 +32,7 @@ public static void Main(string[] args)
3232
{
3333
// Mark that the first list paragraph has been found
3434
isListStart = true;
35-
// Restart numbering for the first list paragraph in the cloned ro
35+
// Restart numbering for the first list paragraph in the cloned row
3636
paragraph.ListFormat.RestartNumbering = true;
3737
}
3838
}

0 commit comments

Comments
 (0)