Sheetjs: Export2Excel.js get TH cell

Created on 2 Mar 2017  路  2Comments  路  Source: SheetJS/sheetjs

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'); }
Read Bug

Most helpful comment

@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

All 2 comments

@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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gustavosimil picture gustavosimil  路  3Comments

goxr3plus picture goxr3plus  路  3Comments

eyalcohen4 picture eyalcohen4  路  3Comments

dullin picture dullin  路  3Comments

HachimDev picture HachimDev  路  3Comments