Open GoogleCodeExporter opened 8 years ago
I cant find any delete method on GetRow(x). How to a row in Excel worksheet ?
Im using: ExcelLibrary_20110730.zip
OS: Windows 7 Premium
Original comment by maxis...@gmail.com
on 10 Jun 2015 at 9:58
A way to delete a row.
private void RemoveRecord(int index)
{
Workbook book = Workbook.Load(excel_filename);
Worksheet _sheet = book.Worksheets[0];
Worksheet _newsheet = new Worksheet(_sheet.Name);
for (int i = _sheet.Cells.FirstRowIndex; i <= _sheet.Cells.LastRowIndex; i++)
{
if(i != index)
{
int lastRow = _newsheet.Cells.Rows.Count;
for (int col_index = _sheet.Cells.FirstColIndex; col_index <= _sheet.Cells.LastColIndex; col_index++ )
{
_newsheet.Cells[lastRow, col_index] = new Cell(_sheet.Cells[i, col_index].StringValue);
}
}
}
book.Worksheets.RemoveAt(0);
_newsheet.Book = book;
book.Worksheets.Add(_newsheet);
book.Save(excel_filename);
}
Original comment by maxis...@gmail.com
on 10 Jun 2015 at 1:11
Original issue reported on code.google.com by
pradipku...@gmail.com
on 28 Nov 2013 at 12:52