How to specify to trim whitespaces using XLSX.utils.table_to_sheet #849

Closed
opened 2017-10-19 08:15:36 +00:00 by laurentauthier · 2 comments
laurentauthier commented 2017-10-19 08:15:36 +00:00 (Migrated from github.com)

is it possible to add this feature?

is it possible to add this feature?
Andreas-Hjortland commented 2017-10-31 14:26:09 +00:00 (Migrated from github.com)

As a workaround you can do something like

table.querySelectorAll('td,th').forEach(elt => elt.innerHTML = elt.innerHTML.trim());

Before you call XLSX.utils.table_to_sheet

As a workaround you can do something like ```javascript table.querySelectorAll('td,th').forEach(elt => elt.innerHTML = elt.innerHTML.trim()); ``` Before you call `XLSX.utils.table_to_sheet`
laurentauthier commented 2017-10-31 14:41:52 +00:00 (Migrated from github.com)

I tried this:
var table = document.getElementById(id);
table.querySelectorAll('tr,th').forEach(elt => elt.innerHTML = elt.innerHTML.trim());
var ws = XLSX.utils.table_to_sheet(table, {raw:true });
no effect, allways whitespaces before and after the value

I tried this: var table = document.getElementById(id); table.querySelectorAll('tr,th').forEach(elt => elt.innerHTML = elt.innerHTML.trim()); var ws = XLSX.utils.table_to_sheet(table, {raw:true }); no effect, allways whitespaces before and after the value
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#849
No description provided.