Fix cornercase of to_csv with skipHidden enabled #1508

Closed
biggestT wants to merge 1 commits from patch-1 into master
biggestT commented 2019-05-15 18:42:41 +00:00 (Migrated from github.com)

When running xlsx.stream.to_csv(sheet, { skipHidden: true }) on the only sheet in this XLS-file from the Swedish Pension Authority the stream never got to on('end'). I think it's because all the rows in the last _read call was set to hidden, leaving the stream kept in limbo. This seems to have fixed it and makes sense to me but I'm not very familiar with node streams.

When running `xlsx.stream.to_csv(sheet, { skipHidden: true })` on the only sheet in [this XLS-file from the Swedish Pension Authority](https://www.pensionsmyndigheten.se/content/dam/pensionsmyndigheten/blanketter---broschyrer---faktablad/statistik/premiepension/fonddata/nuvarande-och-tidigare-fonder/Lista%20alla%20fonder%20.xls) the stream never got to `on('end')`. I think it's because all the rows in the last `_read` call was set to hidden, leaving the stream kept in limbo. This seems to have fixed it and makes sense to me but I'm not very familiar with node streams.
SheetJSDev commented 2019-05-15 18:51:37 +00:00 (Migrated from github.com)

Thanks for sharing. Given how the function is currently implemented, your diagnosis sounds right. The hidden logic is not used in to_html / to_json, so can you confirm that both streams properly terminate when processing the file?

Thanks for sharing. Given how the function is currently implemented, your diagnosis sounds right. The hidden logic is not used in `to_html` / `to_json`, so can you confirm that both streams properly terminate when processing the file?
biggestT commented 2019-05-15 19:41:26 +00:00 (Migrated from github.com)

Nice, to_html and to_json terminated properly for the file yes

Nice, `to_html` and `to_json` terminated properly for the file yes

Pull request closed

Sign in to join this conversation.
No description provided.