monitorjbl / excel-streaming-reader

An easy-to-use implementation of a streaming Excel reader using Apache POI
Apache License 2.0
953 stars 344 forks source link

Ignore formula tag that isn't within a cell #128

Closed cmuchinsky closed 6 years ago

cmuchinsky commented 6 years ago

This pull request fixes an issue where a formula tag that shows up outside of a cell is incorrectly being attached to the previous cell.

ms1111 commented 6 years ago

Oh wow - I can only imagine the horrors that went into producing such a broken file :)

I'm just a user of the library, but the code change looks good to me and includes a unit test and sample file. 👍

Can you tell me where in the sample file to find the errant <f>? I'm not seeing it in sheet1.xml. The last row doesn't seem to have any formula tags.

    <row r="34" spans="2:3" ht="25" customHeight="1" x14ac:dyDescent="0.2">
      <c r="B34" s="5" t="s">
        <v>24</v>
      </c>
      <c r="C34" s="4">
        <v>100</v>
      </c>
    </row>
cmuchinsky commented 6 years ago

Thanks for the second set of eyes @ms1111, the test file is actually an older version of the Manage My Money template from Microsoft. I thought the errant formula tag was after the cell in the row but perhaps not? I never converted it to an xml representation to see clearly where it is, but IIRC it might have been from the Chart Data formula.

monitorjbl commented 6 years ago

Yeah, I don't know how all these wonky worksheets have wound up in the wild. The PR looks good though and thanks for including a test file that demonstrates the issue!