try default password on read failure, closes #161

This commit is contained in:
Thomas Fussell 2019-07-06 15:29:04 -04:00
parent ba01de47a7
commit be7a91f7be

View File

@ -865,7 +865,23 @@ void workbook::load(std::istream &stream)
{
clear();
detail::xlsx_consumer consumer(*this);
consumer.read(stream);
try
{
consumer.read(stream);
}
catch (xlnt::exception &e)
{
if (e.what() == std::string("xlnt::exception : encrypted xlsx, password required"))
{
stream.seekg(0, std::ios::beg);
consumer.read(stream, "VelvetSweatshop");
}
else
{
throw;
}
}
}
void workbook::load(const std::vector<std::uint8_t> &data)