Fixed an exception thrown when parsing external links.

This commit is contained in:
胡剑波 2020-08-25 09:00:22 +08:00
parent 3c7122a78c
commit 0ecad78c1d
3 changed files with 22 additions and 7 deletions

View File

@ -243,6 +243,11 @@ xlnt::detail::Cell parse_cell(xlnt::row_t row_arg, xml::parser *parser)
throw xlnt::exception("unexcpected XML parsing event");
}
}
// Prevents unhandled exceptions from being triggered.
for (auto &attr : parser->attribute_map())
{
(void)attr;
}
}
return c;
}

Binary file not shown.

View File

@ -23,28 +23,28 @@
#include <iostream>
#include <xlnt/cell/cell.hpp>
#include <xlnt/cell/comment.hpp>
#include <xlnt/cell/hyperlink.hpp>
#include <xlnt/cell/cell.hpp>
#include <xlnt/styles/font.hpp>
#include <xlnt/styles/style.hpp>
#include <xlnt/styles/border.hpp>
#include <xlnt/styles/fill.hpp>
#include <xlnt/styles/font.hpp>
#include <xlnt/styles/format.hpp>
#include <xlnt/styles/number_format.hpp>
#include <xlnt/styles/border.hpp>
#include <xlnt/styles/style.hpp>
#include <xlnt/utils/date.hpp>
#include <xlnt/utils/datetime.hpp>
#include <xlnt/utils/time.hpp>
#include <xlnt/utils/timedelta.hpp>
#include <xlnt/utils/variant.hpp>
#include <xlnt/workbook/metadata_property.hpp>
#include <xlnt/workbook/streaming_workbook_reader.hpp>
#include <xlnt/workbook/streaming_workbook_writer.hpp>
#include <xlnt/workbook/workbook.hpp>
#include <xlnt/workbook/metadata_property.hpp>
#include <xlnt/worksheet/column_properties.hpp>
#include <xlnt/worksheet/header_footer.hpp>
#include <xlnt/worksheet/row_properties.hpp>
#include <xlnt/worksheet/sheet_format_properties.hpp>
#include <xlnt/worksheet/header_footer.hpp>
#include <xlnt/worksheet/worksheet.hpp>
#include <detail/cryptography/xlsx_crypto_consumer.hpp>
#include <detail/serialization/vector_streambuf.hpp>
@ -93,6 +93,7 @@ public:
register_test(test_load_save_german_locale);
register_test(test_Issue445_inline_str_load);
register_test(test_Issue445_inline_str_streaming_read);
register_test(test_Issue503_external_link_load);
}
bool workbook_matches_file(xlnt::workbook &wb, const xlnt::path &file)
@ -714,7 +715,7 @@ public:
void test_load_save_german_locale()
{
/* std::locale current(std::locale::global(std::locale("de-DE")));
/* std::locale current(std::locale::global(std::locale("de-DE")));
test_round_trip_rw_custom_heights_widths();
std::locale::global(current);*/
}
@ -736,5 +737,14 @@ public:
auto cell = wbr.read_cell();
xlnt_assert_equals(cell.value<std::string>(), std::string("a"));
}
void test_Issue503_external_link_load()
{
xlnt::workbook wb;
wb.load(path_helper::test_file("Issue503_external_link.xlsx"));
auto ws = wb.active_sheet();
auto cell = ws.cell("A1");
xlnt_assert_equals(cell.value<std::string>(), std::string("WDG_IC_00000003.aut"));
}
};
static serialization_test_suite x;