Prepare for NPOI upgrade.

This commit is contained in:
Andy Howard
2026-09-12 16:05:32 +01:00
parent 1903cb31f1
commit c510adc95c
4 changed files with 271 additions and 3 deletions
@@ -90,6 +90,7 @@ namespace Sarand.Net.Standard.Proc.Excel
catch
{
// If reading fails, try to read workbook as XLS:
fs.Seek(0, SeekOrigin.Begin);
workbook = new HSSFWorkbook(fs);
}
}
@@ -127,6 +128,7 @@ namespace Sarand.Net.Standard.Proc.Excel
catch
{
// If reading fails, try to read workbook as XLS:
workbookStream.Seek(0, SeekOrigin.Begin);
workbook = new HSSFWorkbook(workbookStream);
}
}
@@ -268,8 +270,8 @@ namespace Sarand.Net.Standard.Proc.Excel
SetErrorState(Msg_WorkbookNotOpen);
if (!HasErrorState())
{
for (int sheetPos = 1; sheetPos <= workbook.NumberOfSheets; sheetPos++)
names.Add(workbook.GetSheetName(sheetPos));
for (int sheetIdx = 0; sheetIdx < workbook.NumberOfSheets; sheetIdx++)
names.Add(workbook.GetSheetName(sheetIdx));
}
return new List<String>(names);
}
@@ -786,7 +788,7 @@ namespace Sarand.Net.Standard.Proc.Excel
}
private bool IsCellDate(ICell cell)
{
return cell != null && NPOI.SS.UserModel.DateUtil.IsCellDateFormatted(cell);
return IsCellNumeric(cell) && NPOI.SS.UserModel.DateUtil.IsCellDateFormatted(cell);
}
//-------------------------------------------------------------------