Merge pull request #506 from softmarch/issue_503_external_link

Fixed an exception thrown when parsing external links.
This commit is contained in:
Thomas Fussell 2021-01-02 14:58:28 -05:00 committed by GitHub
commit bfbfd6e94f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 7 deletions

View File

@ -244,6 +244,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>
@ -94,6 +94,7 @@ public:
register_test(test_Issue445_inline_str_load);
register_test(test_Issue445_inline_str_streaming_read);
register_test(test_Issue492_stream_empty_row);
register_test(test_Issue503_external_link_load);
}
bool workbook_matches_file(xlnt::workbook &wb, const xlnt::path &file)
@ -715,7 +716,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);*/
}
@ -754,5 +755,15 @@ public:
xlnt_assert_equals(wbr.read_cell().reference(), "B4");
xlnt_assert(!wbr.has_cell());
}
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;