Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNamed cell reference causes the string "undefined" to be output in the ODS file #1717
Labels
Comments
|
This is actually an issue with a string cell that has no value. The fix is pretty straightforward (feel free to submit a PR): https://github.com/SheetJS/sheetjs/blob/master/bits/81_writeods.js#L81 - textp = cell.v;
+ textp = cell.v == null ? "" : cell.v; |
djrumph
added a commit
to djrumph/sheetjs
that referenced
this issue
Jan 23, 2020
I saw the issue was raised and a SheetJS Dev said the fix was simple and involved dealing with defined and undefined variables. They wrote a line using a ternary conditional to assign the variable textp to the value of cell.v if it's defined, or an empty string if it is not defined. SheetJS Dev Code: textp = cell.v == null ? "" : cell.v; Suggesting using the line: textp = cell.v || ""; This does the same thing and assigns textp to cell.v if it is defined or an empty string if it is not. (Note any feedback would be greatly appreciated, this is my first try at contributing to open source).
geoffrymichael
added a commit
to geoffrymichael/sheetjs
that referenced
this issue
Feb 2, 2020
…issue SheetJS#1717
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The resulting .ODS file contains:
Not sure what
<text:p>is (probably a placeholder?), but it should simply be omitted in this case.Adding a
v: ''to the cell object outputs an empty<text:p></text:p>.That, again, should be omitted, or optimized to
<text:p/>.