想到了一种解决办法:强制删除多余的空行,如下代码:
FpSpread1.OpenExcel(Server.MapPath("1.xlsx"));
for (int s = 0; s < this.FpSpread1.Sheets.Count; s++)
{
int rowCount = this.FpSpread1.Sheets.NonEmptyRowCount;
int colCount = this.FpSpread1.Sheets.NonEmptyColumnCount;
int rowCount2 = this.FpSpread1.Sheets.RowCount;
int colCount2 = this.FpSpread1.Sheets.ColumnCount;
this.FpSpread1.Sheets.Rows.Remove(rowCount, rowCount2 - rowCount);
this.FpSpread1.Sheets.Columns.Remove(colCount, colCount2 - colCount);
}
谁还有更好的解决办法?期待.... |