Export2Excel.js get TH cell #576

Closed
opened 2017-03-02 07:39:07 +00:00 by axolo · 2 comments
axolo commented 2017-03-02 07:39:07 +00:00 (Migrated from github.com)

http://sheetjs.com/demos/table.html
http://sheetjs.com/demos/Export2Excel.js

// Export2Excel.js line 8
var columns = row.getElementsByTagName('td');
// Fixed: get TH cell
if(!columns.length) { columns = row.getElementsByTagName('th'); }
http://sheetjs.com/demos/table.html http://sheetjs.com/demos/Export2Excel.js ```js // Export2Excel.js line 8 var columns = row.getElementsByTagName('td'); // Fixed: get TH cell if(!columns.length) { columns = row.getElementsByTagName('th'); } ```
reviewher commented 2017-03-02 08:20:28 +00:00 (Migrated from github.com)

@axolo It's technically not invalid to have both td and th in the same row:

<table><tr><td>td</td><th>th</th></tr></table>
tdth

That whole thing needs to be changed. It probably should loop through all of the elements (e.g. getElementsByTagName('*') works in IE6+) and check for td or th tags

@axolo It's technically not invalid to have both `td` and `th` in the same row: ```html <table><tr><td>td</td><th>th</th></tr></table> ``` <table><tr><td>td</td><th>th</th></tr></table> That whole thing needs to be changed. It probably should loop through all of the elements (e.g. `getElementsByTagName('*')` works in IE6+) and check for td or th tags
SheetJSDev commented 2017-03-29 11:53:31 +00:00 (Migrated from github.com)

Since we will be needing similar functionality in the future for better processing HTML-as-XLS files, we will be folding the logic into the main library as a utility function table_to_sheet. Stay tuned.

Since we will be needing similar functionality in the future for better processing HTML-as-XLS files, we will be folding the logic into the main library as a utility function `table_to_sheet`. Stay tuned.
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#576
No description provided.