This project has moved. For the latest updates, please go here.

Row template for appending row to table

Oct 12, 2009 at 10:41 PM
Edited Oct 12, 2009 at 10:42 PM

I think use the last row as the "row template" when appending row to table would be more reasonable in most case, so that it act as same behaviour as M$ word.

public Row InsertRow(int index) {
  ...
  /*foreach(Cell c in rows[0].Cells)*/
  forech(Cell c in rows.Last().Cells)
    ...
...

 

Or we can get more flexibility by overloading the InsertRow method and passing one more "templateRow" parameter

 

public Row InsertRow(int index) {
  InsertRow(index, rows.Last());
}

public Row InsertRow(int index, Row templateRow) {
  ...
  foreach(Cell c in templateRow.Cells)
    ...
  ...
}