我目前正试图取代使用 Excel 互操作库的需要,但转向NPOI。我现在用以下代码遇到了一些障碍:
XSSFSheet SheetName = excelWorkbook.GetSheet(sheet);
System.Collections.IEnumerator rows = SheetName.GetRowEnumerator();
while (rows.MoveNext())
{
XSSFRow row = (XSSFRow)rows.Current;
foreach (XSSFCell cell in row.Cells)
{
cellContent = cell.StringCellValue;
}
}
我收到的错误是:
Cannot implicitly convert type 'NPOI.SS.UserModel.ISheet' to 'NPOI.XSSF.UserModel.XSSFSheet'. An explicit conversion exists (are you missing a cast?)
我哪里错了?我确定我没有提到 HSSF。
注意:我确信我犯的错误不止这些,所以如果你发现了什么,请向我指出。