sheet_to_html does not work with blankrows: false option #2272

Open
opened 2 years ago by droka · 1 comments
droka commented 2 years ago (Migrated from github.com)
Owner

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 1 year ago (Migrated from github.com)
Owner

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 project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2272
Loading…
There is no content yet.