No hidden attribute in row properties #2658

Closed
opened 2022-04-18 14:14:26 +00:00 by dkostochko · 1 comment
dkostochko commented 2022-04-18 14:14:26 +00:00 (Migrated from github.com)

Hi!

I tried parse xslx file and got incorrect row properties. There is no attribute "hidden" for hidden rows.

Environment:
sheetjs ver. 0.18.5
xslx file created in LibreOffice with hidden rows (file: https://disk.yandex.by/d/nNDGAN25xFjVCw)

Actual result:
sheet['!rows'] => [ { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 42.5, "hpx": 42.5, "level": 0 }, { "hpt": 40.25, "hpx": 40.25, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, null, null, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 } ]

Actual result:
sheet['!rows'] => [ { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 42.5, "hpx": 42.5, "level": 0 }, { "hpt": 40.25, "hpx": 40.25, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, null, null, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0, hidden: true }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0, hidden: true }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0, hidden: true }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0, hidden: true } ]

I did small investigation and found that
for columns value of attribute "hidden" is parsed via function parsexmlbool
if(coll.hidden) coll.hidden = parsexmlbool(coll.hidden);
but for rows value isn't parsed, only compared with string "1"
if(tag.hidden == "1") { rowrite = true; rowobj.hidden = true; }
LibreOffice produces xslx with value "true" for row attribute "hidden" instead "1".

Hi! I tried parse xslx file and got incorrect row properties. There is no attribute "hidden" for hidden rows. Environment: sheetjs ver. 0.18.5 xslx file created in LibreOffice with hidden rows (file: https://disk.yandex.by/d/nNDGAN25xFjVCw) Actual result: `sheet['!rows'] => [ { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 42.5, "hpx": 42.5, "level": 0 }, { "hpt": 40.25, "hpx": 40.25, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, null, null, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 } ] ` Actual result: `sheet['!rows'] => [ { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 42.5, "hpx": 42.5, "level": 0 }, { "hpt": 40.25, "hpx": 40.25, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, null, null, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0 }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0, hidden: true }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0, hidden: true }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0, hidden: true }, { "hpt": 12.8, "hpx": 12.800000000000002, "level": 0, hidden: true } ] ` I did small investigation and found that for columns value of attribute "hidden" is parsed via function `parsexmlbool` `if(coll.hidden) coll.hidden = parsexmlbool(coll.hidden);` but for rows value isn't parsed, only compared with string "1" `if(tag.hidden == "1") { rowrite = true; rowobj.hidden = true; }` LibreOffice produces xslx with value "true" for row attribute "hidden" instead "1".
SheetJSDev commented 2022-04-18 16:15:18 +00:00 (Migrated from github.com)

Good catch! We'd accept a PR that replaces those "1" or "true" checks with a call to parsexmlbool.

Good catch! We'd accept a PR that replaces those "1" or "true" checks with a call to `parsexmlbool`.
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#2658
No description provided.