tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.49k stars 418 forks source link

Some Excel files don't have a `count` attribute on mergeCells element #459

Closed adg-mh closed 2 years ago

adg-mh commented 4 years ago

I've come across excel files in the wild which don't have a count attribute on mergeCells, causing an exception when reading the file. I have attached an example file which exhibits the issue. The attribute check happens around here.

Would you accept a PR which changes the behavior slightly:

When the count attribute is present, the number of mergeCell children is compared to the count attribute and throws the exception as it does now, but when there is no count attribute, the check is skipped?

test-merge.xlsx

JaosonMa commented 4 years ago

i got the same problem,do you slove it ?

adg-mh commented 4 years ago

Yes, I solved it for myself as outlined by the proposed fix in my initial post. I was waiting for confirmation on that approach before creating the PR and all the tests.

You can just remove the check if want a quick fix (see link in my original post for location of the check).

JaosonMa commented 4 years ago

i got you ,i remove the check for now , hope new code

JaosonMa commented 4 years ago

i also got other problem , the read_shared_string_table() function;

throw invalid_file("sizes don't match");

did you got this too?

tfussell commented 2 years ago

Closing in favor of more recent issue https://github.com/tfussell/xlnt/issues/640.