I got data out of order when I use XLSX.utils.table_to_book to export xlsx. #3175
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#3175
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In Excel
You can clearly see that this line of data is in the wrong position.
At Table of HTML
This table has only one tr label, there's a problem with the data it's exporting. I try to export a table with two tr label, the exported data is normal.
Data
It should start from 1.
Code
None of the images were added -- can you try uploading the screenshot and posting the HTML table?
If you can share the screenshots again, or at least share the HTML table innerHTML code, we can reopen the issue and investigate further.
In fact, I have uploaded a screenshot to this issue, I don't know if you can see it?
You can use this HTML table.
Sorry for this, I ignored the email of this comment.
And I didn't focus comment on this official code repository.
Not sure why it didn't show up the first time.
Thanks for reporting!
At a high level, the HTML DOM TABLE parser uses the
rows
property of thetable
element to enumerate the rows.Your table revealed a funny corner case in how
rows
work.https://html.spec.whatwg.org/multipage/tables.html#forming-a-table when a table row group (THEAD, TBODY, TFOOT) ends, the engine is supposed to effectively insert empty rows to ensure no overlap between groups. Those rows are not added to the
rows
array, and therefore any algorithm that uses the TABLErows
property directly will not work properly.Your example elicits this behavior. The following cells are the header:
Each TD element in the header row has rowspan=2, so from the perspective of
rows
it is one row but the browsers actually treat it as two rows.To understand how SheetJS currently interprets the table, remove the open and close THEAD and TBODY tags. https://jsbin.com/sovatimifo/edit?html,output you will see that the data row is actually added to the end of the second row.
We'll have to do some more testing to ensure this works correctly, but the DOM parser should be scanning
rows
fromtHead
,tBodies
, andtFoot
directly.