Row groups #723
No reviewers
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#723
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "master"
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?
Added a
groupLevel
parameter to the row array that allow you to group rows together.I tested this feature by recreating the the writexlsx demo and adding this to the
!rows
property.Note: I had to modify the dist phony in the make file. When I installed uglifyjs globally it looks like it no longer supported the
--support-ie8
flag and it was replaced with the--ie8
flag. I also had to add afilename=
to the--source-map
flag. Not sure if this was needed for a pull request so feel free to ignore the build and makefile changes.Sorry, I can't see what the issue is with the code climate check because I keep getting a 504 error.
@Danwakeem Thanks for looking into this! I will try to spend some time later today digging into the corner cases, but the representation looks good.
Later on we'll want to have support for the other formats as well. Here's my initial survey of the landscape:
XLSX
Is the default row outline level 1 or 0? ECMA-376 is somewhat unclear: outlinelevel.pdf
ECMA-376 section 18.3.1.13 covers the col xml node, and it says
ECMA-376 section 18.3.1.73 covers the row xml node, and it says
XLS/XLSB
The equivalent XLSB field is 2.4.718
BrtRowHdr
and the XLSB spec shows how the outline level is stored:(which is consistent with 0-7 outline level)
The equivalent XLS field is 2.4.221
Row
and the XLS spec uses the same representation as XLSOther Formats
ODS/FODS use nested
table:table-row-group
tags to indicate outline levelSpreadsheetML and other formats have no support for grouping
Tests
In addition to manual verification, we'll also need to verify that round-tripping preserves the properties. Easiest way is to make a test file exploring corner cases and save in various formats.
https://github.com/SheetJS/js-xlsx/blob/master/test.js#L1403 is the relevant part of the test suite for row properties (starting from a blank slate)
https://github.com/SheetJS/js-xlsx/blob/master/test.js#L902 starts from the row_height test files. https://github.com/SheetJS/test_files/ search for row_height and you'll see:
Based on quick tests, I suspect only the XLSX, XLSB, XLS, and BIFF5 (save as "Excel 5.0/95 Workbook") will be needed.
Misc
Don't worry about the code climate check -- we just removed it :)
Can you unwind the changes to the dist files? those are updated when we cut releases.
Note: We ended up having to fork the minifier to support extendscript. See https://github.com/mishoo/UglifyJS2/issues/1930 for the relevant issue.
https://www.npmjs.com/package/@sheetjs/uglify-js is our fork.
XLSX
Based on the document you sent it looks like the default row outlineRow is 0 since at the bottom of that document in the attributes table it says
and according to the W3C.org page, 3.4.24, the unsignedByte datatype starts at 0 minInclusive.
XLS / XLSB
I have made changes to support XLS / XLSB grouping based on the XLSB page you sent over and the XLS page you sent over. Those were very helpful thank you!
Although I did run into one problem, I don't see a way to generate XLS files in this library. Is that correct or am I missing something?
Other Formats
I will have to look into adding support for ODS/FODS as I am not familiar with these file types.
Tests
I will work on getting the test cases set up for this feature. Hopefully I can get this in tonight!
Misc
I unwinded the changes I made the the
MakeFile
. I will be sure to install that fork of uglify on my local machine in the future. Thanks for the heads up!Wow! Those notes were mostly for me to go back later and review, definitely didn't expect you to go ahead and address the other formats too! 🎉 We can add some test files and roll the whole thing into one commit attributed to you :)
Check your inbox
The commit was changed as follows:
the name is now
level
instead ofgroupLevel
oroutlineLevel
-- the Excel UI labels the button "Group"/"Ungroup", some of the official documentation refer to it as "Outline Level", and the file specs exclusively refer to it as outline.README was updated and a note was added about the discrepancy between the UI and the internal storage
The bit masks were fixed. For 3 bits, the mask is 7 (
1 | 2 | 4
). 15 is the mask for 4 bits (1|2|4|8
)ODS code has a new TODO, at some point we'll add ODS support but it's not worth stopping the next release.
Other miscellaneous changes to ensure that XLSX/XLSB row objects are written even if rows are empty.
The kitchen sink has an outline row -- if you run
node tests/write.js
you'll see the outline row insheetjs.xlsx
andsheetjs.xlsb
Added read tests and roundtrip tests. The read tests are based against the new outline files. It should also serve as a good test file for column outlines.
Even though the PR will show up as closed rather than merged, you should still be marked as a contributor.
Awesome, this is such a cool project and I am glad I could contribute! Thank you very much!
Pull request closed