@@ -57,6 +57,7 @@ enhancements and additional features by request.
57
57
* [ Document Features] ( #document-features )
58
58
+ [ Formulae] ( #formulae )
59
59
+ [ Column Properties] ( #column-properties )
60
+ + [ Row Properties] ( #row-properties )
60
61
+ [ Hyperlinks] ( #hyperlinks )
61
62
+ [ Cell Comments] ( #cell-comments )
62
63
+ [ Sheet Visibility] ( #sheet-visibility )
@@ -97,6 +98,7 @@ enhancements and additional features by request.
97
98
* [ Tested Environments] ( #tested-environments )
98
99
* [ Test Files] ( #test-files )
99
100
- [ Contributing] ( #contributing )
101
+ * [ Tests] ( #tests )
100
102
* [ OSX/Linux] ( #osxlinux )
101
103
* [ Windows] ( #windows )
102
104
- [ License] ( #license )
@@ -630,33 +632,37 @@ In addition to the base sheet keys, worksheets also add:
630
632
parsed, the column objects store the pixel width in the ` wpx ` field, character
631
633
width in the ` wch ` field, and the maximum digit width in the ` MDW ` field.
632
634
635
+ - ` ws['!rows'] ` : array of row properties objects as explained later in the docs.
636
+ Each row object encodes properties including row height and visibility.
637
+
633
638
- ` ws['!merges'] ` : array of range objects corresponding to the merged cells in
634
639
the worksheet. Plaintext utilities are unaware of merge cells. CSV export
635
640
will write all cells in the merge range if they exist, so be sure that only
636
641
the first cell (upper-left) in the range is set.
637
642
638
- - ` ws['protect'] ` : object of write sheet protection properties. The ` password `
643
+ - ` ws['! protect'] ` : object of write sheet protection properties. The ` password `
639
644
key specifies the password for formats that support password-protected sheets
640
645
(XLSX/XLSB/XLS). The writer uses the XOR obfuscation method. The following
641
- keys control the sheet protection (same as ECMA-376 18.3.1.85):
642
-
643
- | key | functionality disabled if value is true |
644
- | :----------------------| :-----------------------------------------------------|
645
- | ` selectLockedCells ` | Select locked cells |
646
- | ` selectUnlockedCells ` | Select unlocked cells |
647
- | ` formatCells ` | Format cells |
648
- | ` formatColumns ` | Format columns |
649
- | ` formatRows ` | Format rows |
650
- | ` insertColumns ` | Insert columns |
651
- | ` insertRows ` | Insert rows |
652
- | ` insertHyperlinks ` | Insert hyperlinks |
653
- | ` deleteColumns ` | Delete columns |
654
- | ` deleteRows ` | Delete rows |
655
- | ` sort ` | Sort |
656
- | ` autoFilter ` | Filter |
657
- | ` pivotTables ` | Use PivotTable reports |
658
- | ` objects ` | Edit objects |
659
- | ` scenarios ` | Edit scenarios |
646
+ keys control the sheet protection -- set to ` false ` to enable a feature when
647
+ sheet is locked or set to ` true ` to disable a feature:
648
+
649
+ | key | feature (true=disabled / false=enabled) | default |
650
+ | :----------------------| :----------------------------------------| :-----------|
651
+ | ` selectLockedCells ` | Select locked cells | enabled |
652
+ | ` selectUnlockedCells ` | Select unlocked cells | enabled |
653
+ | ` formatCells ` | Format cells | disabled |
654
+ | ` formatColumns ` | Format columns | disabled |
655
+ | ` formatRows ` | Format rows | disabled |
656
+ | ` insertColumns ` | Insert columns | disabled |
657
+ | ` insertRows ` | Insert rows | disabled |
658
+ | ` insertHyperlinks ` | Insert hyperlinks | disabled |
659
+ | ` deleteColumns ` | Delete columns | disabled |
660
+ | ` deleteRows ` | Delete rows | disabled |
661
+ | ` sort ` | Sort | disabled |
662
+ | ` autoFilter ` | Filter | disabled |
663
+ | ` pivotTables ` | Use PivotTable reports | disabled |
664
+ | ` objects ` | Edit objects | enabled |
665
+ | ` scenarios ` | Edit scenarios | enabled |
660
666
661
667
- ` ws['!autofilter'] ` : AutoFilter object following the schema:
662
668
@@ -835,6 +841,7 @@ Since Excel prohibits named cells from colliding with names of A1 or RC style
835
841
cell references, a (not-so-simple) regex conversion is possible. BIFF Parsed
836
842
formulae have to be explicitly unwound. OpenFormula formulae can be converted
837
843
with regexes for the most part.
844
+
838
845
#### Column Properties
839
846
840
847
Excel internally stores column widths in a nebulous "Max Digit Width" form. The
@@ -853,10 +860,11 @@ objects which have the following properties:
853
860
854
861
``` typescript
855
862
type ColInfo = {
856
- MDW? : number ; // Excel's "Max Digit Width" unit, always integral
857
- width: number ; // width in Excel's "Max Digit Width", width*256 is integral
858
- wpx? : number ; // width in screen pixels
859
- wch? : number ; // intermediate character calculation
863
+ MDW? : number ; // Excel's "Max Digit Width" unit, always integral
864
+ width: number ; // width in Excel's "Max Digit Width", width*256 is integral
865
+ wpx? : number ; // width in screen pixels
866
+ wch? : number ; // intermediate character calculation
867
+ hidden: ? boolean ; // if true, the column is hidden
860
868
};
861
869
```
862
870
@@ -867,6 +875,29 @@ follow the priority order:
867
875
2 ) use ` wpx ` pixel width if available
868
876
3 ) use ` wch ` character count if available
869
877
878
+ #### Row Properties
879
+
880
+ Excel internally stores row heights in points. The default resolution is 72 DPI
881
+ or 96 PPI, so the pixel and point size should agree. For different resolutions
882
+ they may not agree, so the library separates the concepts.
883
+
884
+ The ` !rows ` array in each worksheet, if present, is a collection of ` RowInfo `
885
+ objects which have the following properties:
886
+
887
+ ``` typescript
888
+ type RowInfo = {
889
+ hpx? : number ; // height in screen pixels
890
+ hpt? : number ; // height in points
891
+ hidden: ? boolean ; // if true, the row is hidden
892
+ };
893
+ ```
894
+
895
+ Even though all of the information is made available, writers are expected to
896
+ follow the priority order:
897
+
898
+ 1 ) use ` hpx ` pixel height if available
899
+ 2 ) use ` hpt ` point height if available
900
+
870
901
#### Hyperlinks
871
902
872
903
Hyperlinks are stored in the ` l ` key of cell objects. The ` Target ` field of the
@@ -1520,6 +1551,25 @@ Running `make init` will refresh the `test_files` submodule and get the files.
1520
1551
Due to the precarious nature of the Open Specifications Promise, it is very
1521
1552
important to ensure code is cleanroom. Consult CONTRIBUTING.md
1522
1553
1554
+ ### Tests
1555
+
1556
+ The ` test_misc ` target (` make test_misc ` on Linux/OSX / ` make misc ` on Windows)
1557
+ runs the targeted feature tests. It should take 5-10 seconds to perform feature
1558
+ tests without testing against the entire test battery. New features should be
1559
+ accompanied with tests for the relevant file formats and features.
1560
+
1561
+ For tests involving the read side, an appropriate feature test would involve
1562
+ reading an existing file and checking the resulting workbook object. If a
1563
+ parameter is involved, files should be read with different values for the param
1564
+ to verify that the feature is working as expected.
1565
+
1566
+ For tests involving a new write feature which can already be parsed, appropriate
1567
+ feature tests would involve writing a workbook with the feature and then opening
1568
+ and verifying that the feature is preserved.
1569
+
1570
+ For tests involving a new write feature without an existing read ability, please
1571
+ add a feature test to the kitchen sink ` tests/write.js ` .
1572
+
1523
1573
### OSX/Linux
1524
1574
1525
1575
The xlsx.js file is constructed from the files in the ` bits ` subdirectory. The
0 commit comments