为什么我删除excle3行后总是有一行没删掉?
我用C#在向excle模板中写入数据时,想把13行到15行删除掉,代码如下:
int startRowIndex = 13;
int endRowIndex = 16;
for (int i = startRowIndex; i < endRowIndex; i++)
{
m_objSheet.Cells[i, 1].EntireRow.Delete (Excel.XlDirection.xlDown);
}
------解决方案--------------------索引重置了?
int startRowIndex = 13;
int endRowIndex = 15;
for (int i = endRowIndex; i > startRowIndex; i--)
{
m_objSheet.Cells[i, 1].EntireRow.Delete (Excel.XlDirection.xlDown);
}
------解决方案--------------------