Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Handle "bare" .xlsx <r> and <c> tags.
An example of such an out-of-spec sheet XML snippet (provided by @EarlJS): <sheetData> <row s="1199" customFormat="1"> <c s="1259" t="s"> <v>1637</v> </c> </row> </sheetData>
- Loading branch information
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @SheetJS — I wonder if you'd accept this as a pullreq? This out-of-spec XML does open in LibreOffice and (presumably) Excel, so it's at least supported by some implementations.
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@audreyt Do you have a sample file?
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please find a minimal example at: http://audreyt.org/tmp/sample.xlsx which opens fine in LibreOffice but not Numbers.app.
The only difference is the missing
r
attributes fromrow
andc
tags.abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@audreyt strangely, neither ECMA-376 nor [MS-XLSX] describe how an optional row should be handled. The XSD for the row element clearly says that the field is optional. I suspect it is intended to increment from the last seen row (implicit_row / implicit_col should take into account the row/col of the last cell, even if it had a row/col specified).
To test this out, can you create another file where cells A1, B2, B4, D4, E4, A5, E5, and F5 are filled?
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@audreyt @EarlJS what version of libreoffice are you using? With the following version I see the right output:
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LibreOffice does not generate such sheets; it just accepts them; I think @EarlJS uses some other XLSX-generating tool that conforms to XSD but not to ECMA.
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EarlJS as described earlier can you generate a file with cells A1, B2, B4, D4, E4, A5, E5, and F5? I want to see if the program uses implicit rows or columns when dealing with gaps
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EarlJS thanks for doing this!
As I suspected, it uses the implicit row/col even with gaps. @audreyt your proposed patch doesn't address this case (implicit_row has to be updated when you see the "r" in a row element). I'll put in a patch to js-xlsx.
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abf4762
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EarlJS @audreyt xlsx v0.7.11 has a better fix. Thanks for reaching out!