Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional check for local tag name. #58

Closed
wants to merge 1 commit into from

Conversation

stoykoNalbantov
Copy link

I am having problems with parsing sheets with "AlternateContent" tags.
For example:
<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <mc:Choice Requires="x14"> <controls> <mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"> <mc:Choice Requires="x14"> <control name="Check Box 47" r:id="rId4" shapeId="47151"> <controlPr autoFill="0" autoLine="0" autoPict="0" defaultSize="0"> <anchor moveWithCells="1"> <from> <xdr:col>15</xdr:col> <xdr:colOff>0</xdr:colOff> <xdr:row>85</xdr:row> <xdr:rowOff>0</xdr:rowOff> </from> <to> <xdr:col>15</xdr:col> <xdr:colOff>247650</xdr:colOff> <xdr:row>85</xdr:row> <xdr:rowOff>0</xdr:rowOff> </to> </anchor> </controlPr> </control> </mc:Choice> </mc:AlternateContent> </controls> </mc:Choice> </mc:AlternateContent>

In this case, the <xdr:row> tag is mistaken for a regular row tag:
<row customFormat="1" hidden="1" ht="15" r="1" s="31" spans="1:32">
When you try to parse a value for "currentRow" from the "r" element, you get "NullpointerException".

Copy link

@antoniy antoniy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This problem is occurring when there is a hidden table/part in the excel document and the new row tag with namespace is added to the XML (with none of the standard row tag attributes needed for parsing rows).

It is safe to just ignore such tags and in our tests - it's working fine.

@monitorjbl
Copy link
Owner

Sorry for taking so long to review this. Could you add a test case that demonstrates this working with an Excel file?

@ms1111
Copy link
Contributor

ms1111 commented Dec 14, 2016

I opened #65 with an alternate fix & test for this.

I decided to look at the namespace. I'm not sure http://schemas.openxmlformats.org/spreadsheetml/2006/main is the only legit namespace - I've seen references online to http://purl.oclc.org/ooxml/spreadsheetml/main - so for now I figured anything ending in "/main" is A-OK, as opposed to http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing which we need to ignore.

@monitorjbl
Copy link
Owner

Closing as I believe #65 fixes this issue

@monitorjbl monitorjbl closed this Jan 10, 2017
rimuln pushed a commit to rimuln/excel-streaming-reader that referenced this pull request Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants