Conditional formatting of cells breaks parsing
jrnt30 opened this issue · comments
Thanks for the repo. New to elixir but found your code interesting to try and learn from.
Found that the Worksheet parser currently breaks if cells contain any conditional formatting elements. In the process of debugging more but need to get to sleep for today.
Symptoms:
ParseWorksheet fails during the :characters
handler as the state is true
and not a map with a value
that contains the contents of the conditional formatting rule (ex. A1<>'Staffing (2)'!A1
) which was parsed from the sheet @
<extLst>
<ext uri="{78C0D931-6437-407d-A8EE-F0AAD7539E65}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
<x14:conditionalFormattings>
<x14:conditionalFormatting xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
<x14:cfRule id="{A977E7D9-018E-4592-92B6-8A1AF77B8E98}" priority="1" type="expression">
<xm:f>A1<>'Staffing (2)'!A1</xm:f>
<x14:dxf>
<fill>
<patternFill>
<bgColor rgb="FF99FF99"/>
</patternFill>
</fill>
</x14:dxf>
</x14:cfRule>
<xm:sqref>A1:XFD1048576</xm:sqref>
</x14:conditionalFormatting>
</x14:conditionalFormattings>
</ext>
</extLst>
Expected:
- System parses correctly
Steps To Reproduce:
- Add conditional formatting to any cell (did this with the test worksheet present in the repo but need to create it's own test tomorrow)
Stacktrace
** (BadMapError) expected a map, got: true
stacktrace:
(xlsxir) lib/xlsxir/parse_worksheet.ex:54: Xlsxir.ParseWorksheet.sax_event_handler/2
/Users/justinn/Development/elixir/xlsxir/deps/erlsom/src/erlsom_sax_utf8.erl:1408: :erlsom_sax_utf8.wrapCallback/2
/Users/justinn/Development/elixir/xlsxir/deps/erlsom/src/erlsom_sax_utf8.erl:984: :erlsom_sax_utf8.parseTextNoIgnore/3
/Users/justinn/Development/elixir/xlsxir/deps/erlsom/src/erlsom_sax_utf8.erl:963: :erlsom_sax_utf8.parseContent/2
/Users/justinn/Development/elixir/xlsxir/deps/erlsom/src/erlsom_sax_utf8.erl:196: :erlsom_sax_utf8.parse/2
(xlsxir) lib/xlsxir/sax_parser.ex:59: Xlsxir.SaxParser.parse/2
(xlsxir) lib/xlsxir.ex:46: Xlsxir.extract/3
@jrnt30 thanks for the feedback. I'll take a look at your pull request as soon as possible (currently out of town for work). I definitely appreciate you taking the time to come up with a solution and creating a test situation for it!
You're very welcome. Please let me know if there is anything that you would like revised that I can help with.
That's great, thanks for doing the heavy lifting!