sheet_to_html does not work with blankrows: false option #2272

Open
opened 2021-04-08 14:32:08 +00:00 by droka · 1 comment
droka commented 2021-04-08 14:32:08 +00:00 (Migrated from github.com)

sheet_to_json and sheet_to_csv both skips blank rows, if the { blankrows: false } option is given

But sheet_to_html does not look at this option,
and so if the worksheet is ending with lots of blank rows (eg. excel can output a sheet with 65565 rows, even if only 10 rows are filled)
then the resulting html has thousands of blank rows.

We can fix this by testing the w value to see if its empty
after xlsx.mini.js Line8467
just like the other 2 functions sheet_to_json and sheet_to_csv both does this check.

If I fix this in sheet_to_html, would it be possible to pull the pull_request?

**sheet_to_json** and **sheet_to_csv** both skips blank rows, if the { blankrows: false } option is given But **sheet_to_html** does not look at this option, and so if the worksheet is ending with lots of blank rows (eg. excel can output a sheet with 65565 rows, even if only 10 rows are filled) then the resulting html has thousands of blank rows. We can fix this by testing the w value to see if its empty after xlsx.mini.js Line8467 just like the other 2 functions **sheet_to_json** and **sheet_to_csv** both does this check. If I fix this in **sheet_to_html**, would it be possible to pull the pull_request?
SheetJSDev commented 2021-09-13 06:53:26 +00:00 (Migrated from github.com)

We could be convinced to accept a PR.

The big challenge with sheet_to_html is interpretation of rowspan (merge cells). CSV and JS row objects / array of arrays don't have a native concept of "merging" -- data is written as if it were in the upper-left cell of the merge range.

Consider the example:

Are rows 2 and 5 blank? After all, the real data is present in cells A1 / B1 / B3 / C4. If they aren't blank, then it's unclear what blankrows really does. If they are blank, then the rowspan in row 1 would have to be adjusted.

We could be convinced to accept a PR. The big challenge with sheet_to_html is interpretation of rowspan (merge cells). CSV and JS row objects / array of arrays don't have a native concept of "merging" -- data is written as if it were in the upper-left cell of the merge range. Consider the example: <img width="202" alt="" src="https://user-images.githubusercontent.com/6070939/133036955-8a2a7f05-aac7-4c02-afaf-124f1dbb7525.png"> Are rows 2 and 5 blank? After all, the real data is present in cells A1 / B1 / B3 / C4. If they aren't blank, then it's unclear what `blankrows` really does. If they are blank, then the rowspan in row 1 would have to be adjusted.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2272
No description provided.