Code Monkey home page Code Monkey logo

Comments (10)

tonyqus avatar tonyqus commented on May 24, 2024

Why do you use HSSF to open xlsx? It should be XSSF. XSSF namespace is for xlsx and HSSF namespace is for xls.

from npoi.

priscilamonteirof avatar priscilamonteirof commented on May 24, 2024

Sorry, this file is XLS not XLSX.

from npoi.

tonyqus avatar tonyqus commented on May 24, 2024

Can you provide the Excel file to reproduce this issue?

A xls file may have a few possible cases. For example, the file is somewhat broken, or the file is too old (generated by Excel 97 and it's old BIFF format). The easiest way to check what's going on is to resave the file with Microsoft Excel and open it again with NPOI. If NPOI can open it after resaving the file, it means there is something fixed (internal record broken) by Microsoft Excel.

from npoi.

priscilamonteirof avatar priscilamonteirof commented on May 24, 2024

I'm trying to attach it but it's not loading. Is there any other way to send it?

from npoi.

tonyqus avatar tonyqus commented on May 24, 2024

You can send it to my email: [email protected]

from npoi.

priscilamonteirof avatar priscilamonteirof commented on May 24, 2024

I just sent the file by email.

from npoi.

tonyqus avatar tonyqus commented on May 24, 2024

I checked the file. The size of FtCfSubRecord is 0, which is incorrect.

Unhandled exception. NPOI.Util.RecordFormatException: Unable to construct record instance
 ---> NPOI.Util.RecordFormatException: Unexpected size (0)
   at NPOI.HSSF.Record.FtCfSubRecord..ctor(ILittleEndianInput in1, Int32 size) in C:\github\npoi\main\HSSF\Record\FtCfSubRecord.cs:line 63
   at NPOI.HSSF.Record.SubRecord.CreateSubRecord(ILittleEndianInput in1, CommonObjectType cmoOt) in C:\github\npoi\main\HSSF\Record\SubRecord\SubRecord.cs:line 58
   at NPOI.HSSF.Record.ObjRecord..ctor(RecordInputStream in1) in C:\github\npoi\main\HSSF\Record\ObjRecord.cs:line 102

After resaving the file with Microsoft Excel, it can be opened correctly with NPOI. It means Excel fixes some internal records. You need to check with the provider of this Excel.

from npoi.

priscilamonteirof avatar priscilamonteirof commented on May 24, 2024

I did exactly that, opened the file in Excel and saved a copy of it.
As soon as I put it to import, the error appeared: Wrong Local header signature: 0xE011CFD0.
Is there anything else that should be done when saving the file?

at ICSharpCode.SharpZipLib.Zip.ZipInputStream.GetNextEntry()
at NPOI.OpenXml4Net.Util.ZipInputStreamZipEntrySource..ctor(ZipInputStream inp)
at NPOI.OpenXml4Net.OPC.ZipPackage..ctor(Stream in1, PackageAccess access)
at NPOI.OpenXml4Net.OPC.OPCPackage.Open(Stream in1)
at NPOI.Util.PackageHelper.Open(Stream is1)
at NPOI.XSSF.UserModel.XSSFWorkbook..ctor(Stream is1)
at Yamaha.GQC.Web.Controllers.SolicitacoesInspecaoController.ValidarArquivoXLS_Modelo2(RealizarInspecaoViewModel realizarInspecaoViewModel) in C:\Yamaha\Fontes\gqc\src\Yamaha.GQC.Web\Controllers\SolicitacoesInspecaoController.cs:line 5723

from npoi.

tonyqus avatar tonyqus commented on May 24, 2024

The file is with xls extension. You should keep using HSSFWorkbook instead of XSSFWorkbook.

from npoi.

priscilamonteirof avatar priscilamonteirof commented on May 24, 2024

ok, I got it, thanks for the help.

I will contact the owner of the file and see what could be done.

from npoi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.