-
Notifications
You must be signed in to change notification settings - Fork 418
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
Sample error #72
Comments
Same here. Some nice example:
|
I guess it's time that I update the outdated samples since they seem to be misguiding potential users. I'll have some commits in the next few days to fix this. |
Some usage guides would be nice. Also, there is another crash, somewhat unrelated, I guess. It can't read files with xlnt::datetime-s, that was previously created by xlnt iteslf.
|
on sample.cpp, the crash is on this line , if i comment is OK? very strange, test OK |
There are a few separate issues here. As @yekm discovered (nice detective work!), iterating over the rows and columns in a workbook is sort of broken at the moment. This doesn't normally show up because iterating over a non-const workbook adds the cells to the internal cell map as it looks them up (see http://en.cppreference.com/w/cpp/container/unordered_map/operator_at). During writing, the workbook is const and the loop to count the number of strings to write to the shared string table was looking up non-existent cells. This particular problem during writing is fixed with commit b83cf64 and the code in the comment now works as expected. More work needs to be done to fix cell iteration. The crash in sample.cpp mentioned by @sukoi26 was caused by bad XML writing/reading for the shared strings file. This is fixed with a commit I will make tonight. This commit will include significant improvements to the build system and supporting files. samples/sample.cpp will be updated and I will begin compiling samples in Travis/AppVeyor to ensure they are always in a working state. After "git pull", it will be necessary to "git submodule init && git submodule update" to get botan which is the new encryption library used for reading password-protected workbooks. Certain builds may fail during this commit but they will be resolved in short time. |
Hello,
After compiling the library under Linux, with no errors, i try the sample :
~/dvp/xlnt/samples$ g++ -std=c++14 -Ixlnt/include -Lxlnt/lib -lxlnt sample.cpp -o sample
I received this error:
GNU gdb (Debian 7.11.1-2) 7.11.1
Reading symbols from ./sample...done.
(gdb) r
Starting program: ~/dvp/xlnt/samples/sample
terminate called after throwing an instance of 'std::out_of_range'
what(): _Map_base::at
Program received signal SIGABRT, Aborted.
0x00007ffff6960fdf in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
0 0x00007ffff6960fdf in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff696240a in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff727804d in __gnu_cxx::__verbose_terminate_handler() ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff7276016 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff7276061 in std::terminate() ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff7276279 in __cxa_throw ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff729e50f in std::__throw_out_of_range(char const*) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x00007ffff789f843 in std::__detail::_Map_base<xlnt::column_t, std::pair<xlnt::column_t const, xlnt::detail::cell_impl>, std::allocator<std::pair<xlnt::column_t const, xlnt::detail::cell_impl> >, std::__detail::_Select1st, std::equal_toxlnt::column_t, std::hashxlnt::column_t, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true>, true>::at(xlnt::column_t const&)
#8 0x00007ffff789d3a3 in std::unordered_map<xlnt::column_t, xlnt::detail::cell_impl, std::hashxlnt::column_t, std::equal_toxlnt::column_t, std::allocator<std::pair<xlnt::column_t const, xlnt::detail::cell_impl> > >::at(xlnt::column_t const&) () from /usr/local/lib/libxlnt.so.0.9
#9 0x00007ffff7894515 in xlnt::worksheet::get_cell(xlnt::cell_reference const&)`
` const () from /usr/local/lib/libxlnt.so.0.9
#10 0x00007ffff7889d7b in xlnt::const_cell_iterator::operator*() const ()
from /usr/local/lib/libxlnt.so.0.9
#11 0x00007ffff7938268 in xlnt::detail::xlsx_producer::write_shared_string_table(xlnt::relationship const&) () from /usr/local/lib/libxlnt.so.0.9
#12 0x00007ffff7933c5a in xlnt::detail::xlsx_producer::write_workbook(xlnt::relationship const&) () from /usr/local/lib/libxlnt.so.0.9
#13 0x00007ffff792544e in xlnt::detail::xlsx_producer::populate_archive() ()
from /usr/local/lib/libxlnt.so.0.9
#14 0x00007ffff7924d24 in xlnt::detail::xlsx_producer::write(xlnt::path const&)
#15 0x00007ffff784e68e in xlnt::workbook::save(xlnt::path const&) const ()
from /usr/local/lib/libxlnt.so.0.9
#16 0x00007ffff784e5a5 in xlnt::workbook::save(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) const ()
from /usr/local/lib/libxlnt.so.0.9
#17 0x00000000004010cd in main ()
The text was updated successfully, but these errors were encountered: