I use closedXML.Report version 0.2.4 for Excel import functionality. It can run normally on some computers, but on some computers it reports an error: Specified part does not exist in the package. Debugging found that it is in Workbook=new XLWorkbook (stream); The exception thrown by this sentence, I don't know what caused it, please help me, thank you.
` public ExcelBuilder LoadFile(IFormFile file)
{
if (file == null || file.Length == 0)
{
throw new AppException(GetMessage(ExcelMessage.ImportFileEmpty));
}
if (!file.FileName.Contains(".xls", StringComparison.OrdinalIgnoreCase) ||
!file.FileName.Contains(".xlsx", StringComparison.OrdinalIgnoreCase))
{
throw new AppException(GetMessage(ExcelMessage.ImportFileFormatError));
}
using (var stream = file.OpenReadStream())
{
Workbook = new XLWorkbook(stream);
Worksheet = Workbook.Worksheets.FirstOrDefault();
RowCount = Worksheet.LastRowUsed().RowNumber();
if (Worksheet == null || Worksheet.LastRowUsed().RowNumber() == 0)
{
throw new AppException(GetMessage(ExcelMessage.ImportFileEmpty));
}
}
return this;
}`
I use closedXML.Report version 0.2.4 for Excel import functionality. It can run normally on some computers, but on some computers it reports an error: Specified part does not exist in the package. Debugging found that it is in Workbook=new XLWorkbook (stream); The exception thrown by this sentence, I don't know what caused it, please help me, thank you.
` public ExcelBuilder LoadFile(IFormFile file)
{
if (file == null || file.Length == 0)
{
throw new AppException(GetMessage(ExcelMessage.ImportFileEmpty));
}
}`