troldal / OpenXLSX

A C++ library for reading, writing, creating and modifying Microsoft Excel® (.xlsx) files.
BSD 3-Clause "New" or "Revised" License
1.37k stars 333 forks source link

can"t open the file #274

Closed wrxhardworking closed 1 month ago

wrxhardworking commented 1 month ago

` OpenXLSX::XLDocument doc;

doc.open("/mnt/c/Users/ISVPO1371/Desktop/Spreadsheet.xlsx");`

terminate called after throwing an instance of 'Zippy::ZipRuntimeError' what(): failed finding central directory

aral-matrix commented 1 month ago

This error originates from zippy.hpp mz_zip_reader_locate_header_sig returning false - there seems to be something wrong with your Spreadsheet.xlsx.

Could you please provide a minimal example file that triggers the error? I'll have a look at it then.

I can reproduce the same issue if I create a completely invalid file by putting random bytes into Spreadsheet.xlsx. Are you sure your example file can be opened by MS Office or LibreOffice?

aral-matrix commented 1 month ago

If there's no response with further information to describe the issue, I'll close it in a few days.

Cici-first commented 1 month ago

I had the same problem, even the newly created xlsx file did not open.

aral-matrix commented 1 month ago

@Cici-first: Good morning! :) Could you be a little more specific? You got the "failed finding central directory" error? 1) What operating system are you on? 2) What path were you trying to open? 3) Can you open the same file from a local folder or does the error also occur on doc.open("./myfile.xlsx")?

Cici-first commented 1 month ago

The error is:terminate called after throwing an instance of 'Zippy::ZipRuntimeError' what(): file open failed The computer is i7 doc.open("./1.xlsx") also failed ,and This file is just created.

aral-matrix commented 1 month ago

So you are getting a different error. I'll close this issue then, and would ask you to open a new issue.

Please be more specific in your description. By your reaction to my first question, I have to assume you are on Windows?

Further communication in the new issue, once you create it. I would like to keep different issues separate.