mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
try default password on read failure, closes #161
This commit is contained in:
parent
ba01de47a7
commit
be7a91f7be
@ -865,7 +865,23 @@ void workbook::load(std::istream &stream)
|
|||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
detail::xlsx_consumer consumer(*this);
|
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)
|
void workbook::load(const std::vector<std::uint8_t> &data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user