Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load password protected xls file got "not found" exception #297

Open
bigtree9307 opened this issue Jun 21, 2018 · 6 comments
Open

load password protected xls file got "not found" exception #297

bigtree9307 opened this issue Jun 21, 2018 · 6 comments

Comments

@bigtree9307
Copy link

bigtree9307 commented Jun 21, 2018

test.xls is a password protected file, if I used wb.load("test.xls"), I got an exception:
$ ./openxls
terminate called after throwing an instance of 'xlnt::exception'
what(): xlnt::exception : encrypted xlsx, password required
Aborted

If I used wb.load("test.xls", "password"), I got an exception:
$ ./openxls
terminate called after throwing an instance of 'xlnt::exception'
what(): xlnt::exception : not found
Aborted

Here is the error stack:

#6  0x00007ffff7a07d01 in xlnt::detail::compound_document::open_read_stream(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/local/lib/libxlnt.so.1.2
#7  0x00007ffff7a22eff in (anonymous namespace)::decrypt_xlsx(std::vector<unsigned char, std::allocator<unsigned char> > const&, std::__cxx11::basic_string<char16_t, std::char_traits<char16_t>, std::allocator<char16_t> > const&) ()
   from /usr/local/lib/libxlnt.so.1.2
#8  0x00007ffff7a231ad in xlnt::detail::decrypt_xlsx(std::vector<unsigned char, std::allocator<unsigned char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /usr/local/lib/libxlnt.so.1.2
---Type <return> to continue, or q <return> to quit---
#9  0x00007ffff7a2327d in xlnt::detail::xlsx_consumer::read(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/local/lib/libxlnt.so.1.2
#10 0x00007ffff79b509a in xlnt::workbook::load(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /usr/local/lib/libxlnt.so.1.2
#11 0x00007ffff79b4df5 in xlnt::workbook::load(xlnt::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /usr/local/lib/libxlnt.so.1.2
#12 0x00007ffff79b4ca3 in xlnt::workbook::load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /usr/local/lib/libxlnt.so.1.2
#13 0x0000555555555024 in main () at openxls.cpp:7
@Crzyrndm
Copy link
Collaborator

Crzyrndm commented Jun 21, 2018

With expected behaviour being:

  • Open and load (i.e. current behaviour is flat out broken)
  • Throwing an exception for incorrect pwd (pwd error is incorrectly reported as file not found)
  • Something else?

Is this against master (/ a release package)? From the tests I gather dev is supposed to be able to open encrypted documents, but I'm not sure of the state of this feature in master

Also, it would be useful to know which program generated the document (MS Excel, Libre Office, ...)

@bigtree9307
Copy link
Author

@Crzyrndm
I installed as the documentation(https://tfussell.gitbooks.io/xlnt/content/docs/introduction/Installation.html) said. And I download the source code from https://github.com/tfussell/xlnt/archive/master.zip.

Here is my code:

  1 #include <iostream>
  2 #include <xlnt/xlnt.hpp>
  3
  4 int main() {
  5   xlnt::workbook wb;
  6   wb.load("test.xls", "password");
  7   auto ws = wb.active_sheet();
  8   return 0;
  9 }

@bigtree9307
Copy link
Author

@Crzyrndm
No matter the password is correct or not, It reported the same exception.

@bigtree9307
Copy link
Author

I recompile from dev branch, but the execption still there.

@bigtree9307
Copy link
Author

I created a xlsx file, It worked! Didn't xlnt support xls file?

@Crzyrndm
Copy link
Collaborator

Crzyrndm commented Jun 21, 2018

Apologies, I missed that this was xlx. xlsx is the only supported format currently. xls support is wishlisted but there is no current implementation for xlnt that I'm aware of :(

#227

A more helpful exception should be a priority here. "File not found" doesn't help with debugging this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants