Shared strings

It can happen that some strings are not unique in sharedstring table
This commit is contained in:
Johann1994 2019-12-18 13:53:23 +01:00 committed by GitHub
parent 49663bc483
commit d6262df555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1923,13 +1923,15 @@ void xlsx_consumer::read_shared_string_table()
{
expect_start_element(qn("spreadsheetml", "si"), xml::content::complex);
auto rt = read_rich_text(qn("spreadsheetml", "si"));
target_.add_shared_string(rt);
//by reading in it can happen we have similar strings from modified excel worksheets...
//so allow to add duplicates
target_.add_shared_string(rt, true);
expect_end_element(qn("spreadsheetml", "si"));
}
expect_end_element(qn("spreadsheetml", "sst"));
if (has_unique_count && unique_count != target_.shared_strings().size())
if (has_unique_count && unique_count != target_.shared_strings_by_id().size())
{
throw invalid_file("sizes don't match");
}