style-xlsx-m 0.1.31 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +18 -6
- package/README.md +50 -15
- package/package.json +116 -108
- package/types/index.d.ts +1 -0
- package/xlsx-js-style/dist/xlsx.bundle.js +25 -11
- package/xlsx-js-style/dist/xlsx.min.js +25 -11
- package/xlsx.js +11 -44
- package/bin/xlsx.njs +0 -310
- package/dist/cpexcel.full.mjs +0 -1502
- package/dist/shim.min.js +0 -2
- package/dist/xlsx.core.min.js +0 -27357
- package/dist/xlsx.core.min.map +0 -1
- package/dist/xlsx.extendscript.js +0 -24643
- package/dist/xlsx.full.min.map +0 -1
- package/dist/xlsx.mini.min.js +0 -13978
- package/dist/xlsx.mini.min.map +0 -1
- package/dist/xlsx.zahl.js +0 -4
- package/dist/xlsx.zahl.mjs +0 -2
- package/types/tsconfig.json +0 -15
- package/xlsx-js-style/bin/xlsx.njs +0 -284
- package/xlsx-js-style/dist/cpexcel.full.mjs +0 -1502
- package/xlsx-js-style/dist/shim.min.js +0 -229
- package/xlsx-js-style/dist/xlsx.bundle.js.map +0 -1
- package/xlsx-js-style/dist/xlsx.min.js.map +0 -1
- package/xlsx-js-style/node_modules/.bin/adler32 +0 -12
- package/xlsx-js-style/node_modules/.bin/adler32.cmd +0 -17
- package/xlsx-js-style/node_modules/.bin/adler32.ps1 +0 -28
- package/xlsx-js-style/node_modules/.bin/codepage +0 -12
- package/xlsx-js-style/node_modules/.bin/codepage.cmd +0 -17
- package/xlsx-js-style/node_modules/.bin/codepage.ps1 +0 -28
- package/xlsx-js-style/node_modules/adler-32/README.md +0 -139
- package/xlsx-js-style/node_modules/adler-32/adler32.js +0 -92
- package/xlsx-js-style/node_modules/adler-32/bin/adler32.njs +0 -87
- package/xlsx-js-style/node_modules/adler-32/package.json +0 -42
- package/xlsx-js-style/node_modules/adler-32/types/index.d.ts +0 -14
- package/xlsx-js-style/node_modules/adler-32/types/tsconfig.json +0 -14
- package/xlsx-js-style/node_modules/adler-32/types/tslint.json +0 -11
- package/xlsx-js-style/node_modules/codepage/README.md +0 -347
- package/xlsx-js-style/node_modules/codepage/bin/codepage.njs +0 -98
- package/xlsx-js-style/node_modules/codepage/bits/10000.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10001.js +0 -115
- package/xlsx-js-style/node_modules/codepage/bits/10002.js +0 -253
- package/xlsx-js-style/node_modules/codepage/bits/10003.js +0 -183
- package/xlsx-js-style/node_modules/codepage/bits/10004.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10005.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10006.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10007.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10008.js +0 -167
- package/xlsx-js-style/node_modules/codepage/bits/10010.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10017.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10021.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10029.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10079.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10081.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/10082.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1010.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1026.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1047.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1132.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1140.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1141.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1142.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1143.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1144.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1145.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1146.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1147.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1148.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1149.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1250.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1251.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1252.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1253.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1254.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1255.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1256.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1257.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1258.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/1361.js +0 -231
- package/xlsx-js-style/node_modules/codepage/bits/20000.js +0 -193
- package/xlsx-js-style/node_modules/codepage/bits/20001.js +0 -217
- package/xlsx-js-style/node_modules/codepage/bits/20002.js +0 -167
- package/xlsx-js-style/node_modules/codepage/bits/20003.js +0 -213
- package/xlsx-js-style/node_modules/codepage/bits/20004.js +0 -193
- package/xlsx-js-style/node_modules/codepage/bits/20005.js +0 -223
- package/xlsx-js-style/node_modules/codepage/bits/20105.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20106.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20107.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20108.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20261.js +0 -31
- package/xlsx-js-style/node_modules/codepage/bits/20269.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20273.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20277.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20278.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20280.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20284.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20285.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20290.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20297.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20420.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20423.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20424.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20833.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20838.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20866.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20871.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20880.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20905.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20924.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/20932.js +0 -189
- package/xlsx-js-style/node_modules/codepage/bits/20936.js +0 -167
- package/xlsx-js-style/node_modules/codepage/bits/20949.js +0 -183
- package/xlsx-js-style/node_modules/codepage/bits/21025.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/21027.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/21866.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28591.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28592.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28593.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28594.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28595.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28596.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28597.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28598.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28599.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28600.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28601.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28603.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28604.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28605.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/28606.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/29001.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/37.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/38598.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/437.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/47451.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/500.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/50220.js +0 -395
- package/xlsx-js-style/node_modules/codepage/bits/50221.js +0 -395
- package/xlsx-js-style/node_modules/codepage/bits/50222.js +0 -395
- package/xlsx-js-style/node_modules/codepage/bits/50225.js +0 -259
- package/xlsx-js-style/node_modules/codepage/bits/50227.js +0 -257
- package/xlsx-js-style/node_modules/codepage/bits/51932.js +0 -171
- package/xlsx-js-style/node_modules/codepage/bits/51936.js +0 -257
- package/xlsx-js-style/node_modules/codepage/bits/51949.js +0 -183
- package/xlsx-js-style/node_modules/codepage/bits/52936.js +0 -7
- package/xlsx-js-style/node_modules/codepage/bits/54936.js +0 -257
- package/xlsx-js-style/node_modules/codepage/bits/57002.js +0 -39
- package/xlsx-js-style/node_modules/codepage/bits/57003.js +0 -23
- package/xlsx-js-style/node_modules/codepage/bits/57004.js +0 -7
- package/xlsx-js-style/node_modules/codepage/bits/57005.js +0 -15
- package/xlsx-js-style/node_modules/codepage/bits/57006.js +0 -23
- package/xlsx-js-style/node_modules/codepage/bits/57007.js +0 -21
- package/xlsx-js-style/node_modules/codepage/bits/57008.js +0 -17
- package/xlsx-js-style/node_modules/codepage/bits/57009.js +0 -13
- package/xlsx-js-style/node_modules/codepage/bits/57010.js +0 -15
- package/xlsx-js-style/node_modules/codepage/bits/57011.js +0 -17
- package/xlsx-js-style/node_modules/codepage/bits/620.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/708.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/720.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/737.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/775.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/808.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/850.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/852.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/855.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/857.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/858.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/860.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/861.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/862.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/863.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/864.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/865.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/866.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/869.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/870.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/872.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/874.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/875.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/895.js +0 -2
- package/xlsx-js-style/node_modules/codepage/bits/932.js +0 -95
- package/xlsx-js-style/node_modules/codepage/bits/936.js +0 -257
- package/xlsx-js-style/node_modules/codepage/bits/949.js +0 -253
- package/xlsx-js-style/node_modules/codepage/bits/950.js +0 -179
- package/xlsx-js-style/node_modules/codepage/cptable.js +0 -6347
- package/xlsx-js-style/node_modules/codepage/cputils.js +0 -528
- package/xlsx-js-style/node_modules/codepage/dist/LICENSE +0 -14
- package/xlsx-js-style/node_modules/codepage/dist/cpexcel.full.js +0 -1505
- package/xlsx-js-style/node_modules/codepage/dist/cputils.js +0 -528
- package/xlsx-js-style/node_modules/codepage/dist/sbcs.full.js +0 -639
- package/xlsx-js-style/node_modules/codepage/node_modules/commander/CHANGELOG.md +0 -350
- package/xlsx-js-style/node_modules/codepage/node_modules/commander/Readme.md +0 -408
- package/xlsx-js-style/node_modules/codepage/node_modules/commander/index.js +0 -1157
- package/xlsx-js-style/node_modules/codepage/node_modules/commander/package.json +0 -37
- package/xlsx-js-style/node_modules/codepage/node_modules/commander/typings/index.d.ts +0 -309
- package/xlsx-js-style/node_modules/codepage/package.json +0 -67
- package/xlsx-js-style/node_modules/codepage/types/index.d.ts +0 -39
- package/xlsx-js-style/node_modules/codepage/types/tsconfig.json +0 -14
- package/xlsx-js-style/node_modules/codepage/types/tslint.json +0 -11
- package/xlsx-js-style/types/index.d.ts +0 -1068
- package/xlsx-js-style/types/tsconfig.json +0 -15
- package/xlsx.mjs +0 -24600
- package/xlsxworker.js +0 -14
- /package/{xlsx-js-style/node_modules/adler-32/LICENSE → third-party-licenses/adler-32-LICENSE} +0 -0
- /package/{xlsx-js-style/node_modules/codepage/LICENSE → third-party-licenses/codepage-LICENSE} +0 -0
- /package/{xlsx-js-style/node_modules/codepage/node_modules/commander/LICENSE → third-party-licenses/commander-LICENSE} +0 -0
package/NOTICE
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
style-xlsx-m
|
|
2
|
-
Copyright 2022-present Shukurov
|
|
2
|
+
Copyright 2022-present Shahrom Shukurov
|
|
3
3
|
|
|
4
4
|
This product is a derivative work and includes software developed by others:
|
|
5
5
|
|
|
@@ -8,16 +8,16 @@ This product is a derivative work and includes software developed by others:
|
|
|
8
8
|
https://github.com/SheetJS/sheetjs
|
|
9
9
|
Licensed under the Apache License, Version 2.0.
|
|
10
10
|
|
|
11
|
-
2. xlsx-js-style
|
|
11
|
+
2. xlsx-js-style 1.2.0
|
|
12
12
|
https://github.com/gitbrent/xlsx-js-style
|
|
13
13
|
A fork of SheetJS Community Edition that adds cell styling on write.
|
|
14
14
|
Licensed under the Apache License, Version 2.0.
|
|
15
15
|
Its compiled output is bundled in ./xlsx-js-style/ and is used by this
|
|
16
16
|
package for XLSX.write / XLSX.writeFile.
|
|
17
17
|
|
|
18
|
-
Changes made in style-xlsx-m (by Shukurov
|
|
19
|
-
- XLSX.read / XLSX.readFile with { cellStyles: true }
|
|
20
|
-
(xlsx format only),
|
|
18
|
+
Changes made in style-xlsx-m (by Shahrom Shukurov):
|
|
19
|
+
- XLSX.read / XLSX.readFile with { cellStyles: true } expose selected cell styles
|
|
20
|
+
(xlsx format only), with round-trip limitations documented in README.md.
|
|
21
21
|
- XLSX.utils.sheet_to_json accepts { getCellStyles: true } and returns
|
|
22
22
|
{ out, styles }.
|
|
23
23
|
- Worksheet page setup (paperSize, scale, fitToWidth, orientation) is read
|
|
@@ -25,9 +25,21 @@ Changes made in style-xlsx-m (by Shukurov Shahrom):
|
|
|
25
25
|
- XLSX.write / writeFile / writeFileSync / writeXLSX / writeFileXLSX are
|
|
26
26
|
delegated to the bundled xlsx-js-style build.
|
|
27
27
|
|
|
28
|
-
Modified source files carry a "Modified by Shukurov
|
|
28
|
+
Modified source files carry a "Modified by Shahrom Shukurov" notice. The
|
|
29
29
|
original copyright headers have been kept.
|
|
30
30
|
|
|
31
31
|
This project is not affiliated with or endorsed by SheetJS LLC.
|
|
32
32
|
"SheetJS" is a trademark of its owner and is used here only to describe the
|
|
33
33
|
origin of the code.
|
|
34
|
+
|
|
35
|
+
Neither upstream npm tarball (xlsx 0.18.5, xlsx-js-style 1.2.0) ships a NOTICE
|
|
36
|
+
file. Their Apache 2.0 LICENSE texts and distributed copyright headers remain
|
|
37
|
+
intact. Bundled codepage and adler-32 notices, and the vendored commander
|
|
38
|
+
license, are also retained in third-party-licenses/. External npm dependencies
|
|
39
|
+
retain their own license files when installed.
|
|
40
|
+
|
|
41
|
+
Additional locally modified sources: xlsx.mjs, types/index.d.ts,
|
|
42
|
+
dist/xlsx.core.min.js, dist/xlsx.mini.min.js, dist/xlsx.extendscript.js,
|
|
43
|
+
xlsx-js-style/dist/xlsx.min.js, xlsx-js-style/dist/xlsx.bundle.js,
|
|
44
|
+
xlsx-js-style/dist/shim.min.js, xlsx-js-style/types/index.d.ts. These include
|
|
45
|
+
legacy source builds that are not shipped in the release tarball.
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# style-xlsx-m
|
|
2
2
|
|
|
3
|
-
Read and write `.xlsx` files in Node.js
|
|
3
|
+
Read and write `.xlsx` files with selected cell styles in Node.js or bundled browser code, and set page setup for printing.
|
|
4
|
+
|
|
5
|
+

|
|
4
6
|
|
|
5
7
|
Based on [SheetJS Community Edition](https://github.com/SheetJS/sheetjs) (`xlsx` 0.18.5) and [xlsx-js-style](https://github.com/gitbrent/xlsx-js-style).
|
|
6
8
|
|
|
@@ -11,11 +13,11 @@ Based on [SheetJS Community Edition](https://github.com/SheetJS/sheetjs) (`xlsx`
|
|
|
11
13
|
| | SheetJS (npm `xlsx`) | xlsx-js-style | style-xlsx-m |
|
|
12
14
|
| :-- | :-- | :-- | :-- |
|
|
13
15
|
| Write cell styles | no | yes | yes |
|
|
14
|
-
| Read
|
|
16
|
+
| Read styles ready for styled writing | fill metadata only | fill metadata only | selected styles (`cellStyles: true`; see limitations) |
|
|
15
17
|
| `sheet_to_json` returns styles | no | no | yes (`getCellStyles: true`) |
|
|
16
18
|
| Page setup (`!pageSetup`) | no | no | yes |
|
|
17
19
|
|
|
18
|
-
The use case is editing
|
|
20
|
+
The use case is editing a tested Excel template: read it, change the data, and save it with the supported formatting. Test your own templates before relying on a round trip.
|
|
19
21
|
|
|
20
22
|
## Installation
|
|
21
23
|
|
|
@@ -50,7 +52,11 @@ For everything else (`utils`, `read` options, other formats) see the [SheetJS do
|
|
|
50
52
|
|
|
51
53
|
## Reading a file with styles
|
|
52
54
|
|
|
53
|
-
Pass `{ cellStyles: true }` to `readFile` (or `read`).
|
|
55
|
+
Pass `{ cellStyles: true }` to `readFile` (or `read`). Styled cells expose an `s` object for the writer. The independent openpyxl fixture confirms RGB solid fills, a theme-4 fill with tint, RGB/theme borders, font name/size/colour, bold/italic/single underline, and alignment. Number/date formats, merges, column widths, row heights, and A4 landscape page setup with scale 91 also survive that fixture. This is a partial round trip; see the limitations below.
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
The images are real LibreOffice renders of `.xlsx` files created with a locally packed build of this package. Blue outlines mark the three changed values. An independent openpyxl check confirmed that fonts, fills, borders and number formats stayed unchanged in this example.
|
|
54
60
|
|
|
55
61
|
```js
|
|
56
62
|
const XLSX = require('style-xlsx-m');
|
|
@@ -58,7 +64,7 @@ const XLSX = require('style-xlsx-m');
|
|
|
58
64
|
const wb = XLSX.readFile('./demo.xlsx', { cellStyles: true });
|
|
59
65
|
const ws = wb.Sheets['demo'];
|
|
60
66
|
|
|
61
|
-
ws.A1.v = 'changed'; // value
|
|
67
|
+
ws.A1.v = 'changed'; // change the value; supported styles are written back
|
|
62
68
|
XLSX.writeFile(wb, 'demo-edited.xlsx');
|
|
63
69
|
```
|
|
64
70
|
|
|
@@ -67,16 +73,35 @@ Styles are also available per row from `sheet_to_json`:
|
|
|
67
73
|
```js
|
|
68
74
|
const { out, styles } = XLSX.utils.sheet_to_json(ws, { header: 1, getCellStyles: true });
|
|
69
75
|
// out[r][c] -> cell value
|
|
70
|
-
// styles[r][
|
|
76
|
+
// styles[r][i] -> style of the i-th visited cell ({} without a style)
|
|
71
77
|
```
|
|
72
78
|
|
|
73
79
|
Note: `styles[r]` lists the cells that `sheet_to_json` visits in that row, in order. It can be shorter than the sheet's width.
|
|
74
80
|
|
|
75
81
|
Reading styles works for `.xlsx` only, not `.xls`.
|
|
76
82
|
|
|
83
|
+
The `main` and `module` entries use the same style-reading build. In bundled browser code, use `import XLSX from 'style-xlsx-m'` and `XLSX.read(bytes, { type: 'array', cellStyles: true })` with a `Uint8Array` or `ArrayBuffer`. `readFile` requires the Node.js filesystem. Importing, editing and saving a styled template is tested with webpack for browser and Node.js targets. The corrected local build is also tested in React with Vite in development and production and real Chrome downloads; these corrections have not yet been published to npm.
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
import XLSX from 'style-xlsx-m';
|
|
87
|
+
|
|
88
|
+
async function editTemplateInBrowser() {
|
|
89
|
+
const response = await fetch('/Book1.xlsx');
|
|
90
|
+
if (!response.ok) throw new Error(`Template request failed: ${response.status}`);
|
|
91
|
+
const bytes = await response.arrayBuffer();
|
|
92
|
+
const wb = XLSX.read(bytes, { type: 'array', cellStyles: true, cellNF: true });
|
|
93
|
+
const ws = wb.Sheets[wb.SheetNames[0]];
|
|
94
|
+
ws.B3.v = 'Edited in React';
|
|
95
|
+
delete ws.B3.w; // discard the cached display text
|
|
96
|
+
XLSX.writeFile(wb, 'Book1-edited.xlsx');
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Call this function from a React button handler. Edit existing cell objects to keep their `s` style; recreating the sheet from values discards those styles. The parser and styled writer are shared with Node.js. Styled blank cells remain blank, and font `family`/`scheme` and theme-index-0 solid fills survive the tested local round trips.
|
|
101
|
+
|
|
77
102
|
## Cell styles reference
|
|
78
103
|
|
|
79
|
-
A cell is `{ v: value, t: type, s: style }`. The
|
|
104
|
+
A cell is `{ v: value, t: type, s: style }`. The example below writes `alignment`, `border`, `fill` and `font`. Set the cell's `z` property for a number format.
|
|
80
105
|
|
|
81
106
|
```js
|
|
82
107
|
const COLOR = { rgb: 'FF0000' }; // hex value, no leading "#"
|
|
@@ -97,11 +122,15 @@ const style = {
|
|
|
97
122
|
bottom: border,
|
|
98
123
|
left: border,
|
|
99
124
|
right: border,
|
|
100
|
-
diagonal: { style: 'thin', color: COLOR
|
|
125
|
+
diagonal: { style: 'thin', color: COLOR },
|
|
126
|
+
diagonalUp: false,
|
|
127
|
+
diagonalDown: true,
|
|
101
128
|
},
|
|
102
129
|
font: {
|
|
103
130
|
name: 'Calibri',
|
|
104
131
|
sz: 11, // points
|
|
132
|
+
family: 2,
|
|
133
|
+
scheme: 'minor',
|
|
105
134
|
color: COLOR,
|
|
106
135
|
bold: false,
|
|
107
136
|
italic: false,
|
|
@@ -137,19 +166,25 @@ When a file is **read**, `ws['!pageSetup']` is the raw `<pageSetup .../>` XML ta
|
|
|
137
166
|
|
|
138
167
|
- Based on SheetJS 0.18.5 (see the security note above). Do not parse untrusted files.
|
|
139
168
|
- Cell styles are read from `.xlsx` only, not `.xls`.
|
|
140
|
-
- Reading is
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
169
|
+
- Reading is a partial round trip. RGB and theme-4 solid fills with tint and a theme-index-0 fill are preserved in the tested local fixtures. These fixes are not yet in the published npm version 0.1.34.
|
|
170
|
+
- Excel Table objects and their table styles (for example, Table1 with striped rows in Book1.xlsx) are not preserved. This limitation applies in both Node.js and browsers; table styles are not cell `s` styles.
|
|
171
|
+
- An empty sheet returns `[]` even when `getCellStyles: true` is requested.
|
|
172
|
+
- Indexed border colours are exposed and saved as RGB. The tested indexed red keeps its RGB colour, but loses the indexed palette reference. Theme border colours keep their theme and tint. Custom theme palettes have not been tested.
|
|
173
|
+
- Single underline is confirmed. Other underline variants, gradient fills, conditional formatting, and diagonal border reading are not verified. Do not assume they are preserved.
|
|
174
|
+
- Number formats are preserved in the tested numeric and date cells, but are not part of `s`; use `cellNF: true` to expose them in `cell.z`. Merges, column widths and row heights are worksheet metadata (`!merges`, `!cols`, `!rows`), not cell styles.
|
|
175
|
+
- `!pageSetup` is returned as a raw XML string on read. The original A4/landscape/scale tag is preserved on save. To change it, assign the object shown above with string values. Numeric object values and other print settings are not verified.
|
|
176
|
+
- The TypeScript definitions are inherited from SheetJS with a `getCellStyles` option added. `s` and `!pageSetup` are not fully typed, and the `sheet_to_json` return types do not describe `{ out, styles }`.
|
|
177
|
+
- The `main` and `module` entries share the tested style reader. The separate CDN entries (`unpkg` and `jsdelivr`) remain upstream SheetJS builds and do not provide the same style-reading guarantees. The corrected local build is tested in React/Vite; Next.js applications have not been tested.
|
|
178
|
+
- Only these synchronous write functions are delegated to xlsx-js-style: `write`, `writeFile`, `writeFileSync`, `writeXLSX`, `writeFileXLSX`. `writeFileAsync` uses the inherited SheetJS writer and is outside these style guarantees.
|
|
144
179
|
|
|
145
180
|
## Credits & License
|
|
146
181
|
|
|
147
182
|
This package is a fork of [SheetJS Community Edition](https://github.com/SheetJS/sheetjs) and includes code from [xlsx-js-style](https://github.com/gitbrent/xlsx-js-style). Both are licensed under the Apache License 2.0.
|
|
148
183
|
|
|
149
|
-
Changes in this fork (by Shukurov
|
|
150
|
-
- Reading existing `.xlsx` files
|
|
184
|
+
Changes in this fork (by Shahrom Shukurov):
|
|
185
|
+
- Reading selected cell styles from existing `.xlsx` files (`cellStyles: true`)
|
|
151
186
|
- `getCellStyles` option for `sheet_to_json`
|
|
152
187
|
- Page setup for printing (paper size, orientation, scale)
|
|
153
188
|
|
|
154
189
|
This project is not affiliated with or endorsed by SheetJS LLC.
|
|
155
|
-
Licensed under the Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
190
|
+
Licensed under the Apache License 2.0. See [LICENSE](https://github.com/MOR8T/style-xlsx-m/blob/main/LICENSE) and [NOTICE](https://github.com/MOR8T/style-xlsx-m/blob/main/NOTICE).
|
package/package.json
CHANGED
|
@@ -1,110 +1,118 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
2
|
+
"name": "style-xlsx-m",
|
|
3
|
+
"version": "0.1.35",
|
|
4
|
+
"author": "Shahrom Shukurov",
|
|
5
|
+
"description": "Fork of SheetJS (xlsx 0.18.5) and xlsx-js-style: read .xlsx files with cell styles, write styled cells, and set page setup for printing.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"excel",
|
|
8
|
+
"xls",
|
|
9
|
+
"xlsx",
|
|
10
|
+
"xlsm",
|
|
11
|
+
"xlsb",
|
|
12
|
+
"ods",
|
|
13
|
+
"csv",
|
|
14
|
+
"dbf",
|
|
15
|
+
"dif",
|
|
16
|
+
"sylk",
|
|
17
|
+
"office",
|
|
18
|
+
"spreadsheet",
|
|
19
|
+
"style",
|
|
20
|
+
"print",
|
|
21
|
+
"format",
|
|
22
|
+
"workbook",
|
|
23
|
+
"worksheet",
|
|
24
|
+
"styles",
|
|
25
|
+
"export",
|
|
26
|
+
"sheetjs",
|
|
27
|
+
"xlsx-js-style",
|
|
28
|
+
"page-setup"
|
|
29
|
+
],
|
|
30
|
+
"main": "xlsx.js",
|
|
31
|
+
"module": "./xlsx.js",
|
|
32
|
+
"unpkg": "dist/xlsx.full.min.js",
|
|
33
|
+
"jsdelivr": "dist/xlsx.full.min.js",
|
|
34
|
+
"types": "types/index.d.ts",
|
|
35
|
+
"browser": {
|
|
36
|
+
"buffer": false,
|
|
37
|
+
"crypto": false,
|
|
38
|
+
"stream": false,
|
|
39
|
+
"process": false,
|
|
40
|
+
"fs": false
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"adler-32": "~1.3.0",
|
|
45
|
+
"cfb": "~1.2.1",
|
|
46
|
+
"codepage": "~1.15.0",
|
|
47
|
+
"crc-32": "~1.2.1",
|
|
48
|
+
"ssf": "~0.11.2",
|
|
49
|
+
"wmf": "~1.0.1",
|
|
50
|
+
"word": "~0.3.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@sheetjs/uglify-js": "~2.7.3",
|
|
54
|
+
"@types/node": "^8.5.9",
|
|
55
|
+
"acorn": "7.4.1",
|
|
56
|
+
"alex": "8.1.1",
|
|
57
|
+
"blanket": "~1.2.3",
|
|
58
|
+
"commander": "~2.17.1",
|
|
59
|
+
"dtslint": "^0.1.2",
|
|
60
|
+
"eslint": "7.23.0",
|
|
61
|
+
"eslint-plugin-html": "^6.1.2",
|
|
62
|
+
"eslint-plugin-json": "^2.1.2",
|
|
63
|
+
"exit-on-epipe": "~1.0.1",
|
|
64
|
+
"fflate": "^0.7.1",
|
|
65
|
+
"jsdom": "~11.1.0",
|
|
66
|
+
"markdown-spellcheck": "^1.3.1",
|
|
67
|
+
"mocha": "~2.5.3",
|
|
68
|
+
"sinon": "^1.17.7",
|
|
69
|
+
"typescript": "2.2.0",
|
|
70
|
+
"webpack": "5.111.1"
|
|
71
|
+
},
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/MOR8T/style-xlsx-m.git"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"test": "node test/run.js"
|
|
78
|
+
},
|
|
79
|
+
"config": {
|
|
80
|
+
"blanket": {
|
|
81
|
+
"pattern": "xlsx.js"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"alex": {
|
|
85
|
+
"allow": [
|
|
86
|
+
"chinese",
|
|
87
|
+
"special",
|
|
88
|
+
"simple",
|
|
89
|
+
"just",
|
|
90
|
+
"crash",
|
|
91
|
+
"wtf",
|
|
92
|
+
"holes"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"homepage": "https://github.com/MOR8T/style-xlsx-m#readme",
|
|
96
|
+
"bugs": {
|
|
97
|
+
"url": "https://github.com/MOR8T/style-xlsx-m/issues"
|
|
98
|
+
},
|
|
99
|
+
"license": "Apache-2.0",
|
|
100
|
+
"engines": {
|
|
101
|
+
"node": ">=0.8"
|
|
102
|
+
},
|
|
103
|
+
"files": [
|
|
104
|
+
"LICENSE",
|
|
105
|
+
"NOTICE",
|
|
106
|
+
"README.md",
|
|
107
|
+
"xlsx.js",
|
|
108
|
+
"types/index.d.ts",
|
|
109
|
+
"dist/LICENSE",
|
|
110
|
+
"dist/cpexcel.js",
|
|
111
|
+
"dist/xlsx.full.min.js",
|
|
112
|
+
"xlsx-js-style/dist/LICENSE",
|
|
113
|
+
"xlsx-js-style/dist/xlsx.min.js",
|
|
114
|
+
"xlsx-js-style/dist/xlsx.bundle.js",
|
|
115
|
+
"xlsx-js-style/dist/cpexcel.js",
|
|
116
|
+
"third-party-licenses/"
|
|
117
|
+
]
|
|
110
118
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* index.d.ts (C) 2015-present SheetJS and contributors */
|
|
2
|
+
/* Modified by Shahrom Shukurov: getCellStyles option and worksheet naming declaration in the inherited definitions. See NOTICE. */
|
|
2
3
|
// TypeScript Version: 2.2
|
|
3
4
|
// import * as CFB from "cfb";
|
|
4
5
|
// import * as SSF from "ssf";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* xlsx-js-style 1.2.0-beta @ 2022-04-05T01:40:40.843Z */
|
|
2
|
+
/* Modified by Shahrom Shukurov: page setup and sheet_to_json style collection in the bundled writer; local formatting. See NOTICE. */
|
|
2
3
|
var XLSX = {};
|
|
3
4
|
function make_xlsx_lib(a) {
|
|
4
5
|
(a.version = "0.18.5"), (a.style_version = "1.2.0");
|
|
@@ -14426,8 +14427,8 @@ function make_xlsx_lib(a) {
|
|
|
14426
14427
|
(r = (function (e, t, r, a) {
|
|
14427
14428
|
if (
|
|
14428
14429
|
(e.c && r["!comments"].push([t, e.c]),
|
|
14429
|
-
(void 0 === e.v && "string" != typeof e.f) ||
|
|
14430
|
-
("z" === e.t && !e.f))
|
|
14430
|
+
((void 0 === e.v && "string" != typeof e.f) ||
|
|
14431
|
+
("z" === e.t && !e.f)) && !e.s)
|
|
14431
14432
|
)
|
|
14432
14433
|
return "";
|
|
14433
14434
|
var n = "",
|
|
@@ -14457,6 +14458,8 @@ function make_xlsx_lib(a) {
|
|
|
14457
14458
|
var o = $t("v", kt(n)),
|
|
14458
14459
|
c = { r: t },
|
|
14459
14460
|
l = el(a.cellXfs, e, a);
|
|
14461
|
+
if (("z" === e.t && !e.f) || (null == e.v && "string" != typeof e.f))
|
|
14462
|
+
o = "";
|
|
14460
14463
|
switch ((0 !== l && (c.s = l), e.t)) {
|
|
14461
14464
|
case "n":
|
|
14462
14465
|
break;
|
|
@@ -26276,7 +26279,15 @@ function make_xlsx_lib(a) {
|
|
|
26276
26279
|
});
|
|
26277
26280
|
return (
|
|
26278
26281
|
(a.prototype.escapeAttributeValue = function (e) {
|
|
26279
|
-
return
|
|
26282
|
+
return (
|
|
26283
|
+
'"' +
|
|
26284
|
+
e
|
|
26285
|
+
.replace(/&(?!(?:amp|lt|gt|quot|apos|#[0-9]+|#x[0-9a-fA-F]+);)/g, "&")
|
|
26286
|
+
.replace(/</g, "<")
|
|
26287
|
+
.replace(/>/g, ">")
|
|
26288
|
+
.replace(/\"/g, """) +
|
|
26289
|
+
'"'
|
|
26290
|
+
);
|
|
26280
26291
|
}),
|
|
26281
26292
|
(a.prototype.toXml = function (e) {
|
|
26282
26293
|
// in this function make style tag
|
|
@@ -26456,12 +26467,15 @@ function make_xlsx_lib(a) {
|
|
|
26456
26467
|
},
|
|
26457
26468
|
_addFont: function (e) {
|
|
26458
26469
|
if (!e) return 0;
|
|
26470
|
+
var fontColor;
|
|
26459
26471
|
var t = vu("font")
|
|
26460
26472
|
.append(vu("sz").attr("val", e.sz || this.defaultStyle.font.sz))
|
|
26461
26473
|
.append(
|
|
26462
26474
|
vu("name").attr("val", e.name || this.defaultStyle.font.name)
|
|
26463
26475
|
);
|
|
26464
26476
|
e.bold && t.append(vu("b")),
|
|
26477
|
+
e.family != null && t.append(vu("family").attr("val", e.family)),
|
|
26478
|
+
e.scheme != null && t.append(vu("scheme").attr("val", e.scheme)),
|
|
26465
26479
|
e.underline && t.append(vu("u")),
|
|
26466
26480
|
e.italic && t.append(vu("i")),
|
|
26467
26481
|
e.strike && t.append(vu("strike")),
|
|
@@ -26469,12 +26483,12 @@ function make_xlsx_lib(a) {
|
|
|
26469
26483
|
e.shadow && t.append(vu("shadow")),
|
|
26470
26484
|
e.vertAlign && t.append(vu("vertAlign").attr("val", e.vertAlign)),
|
|
26471
26485
|
e.color &&
|
|
26472
|
-
(e.color.theme
|
|
26473
|
-
? (
|
|
26474
|
-
|
|
26475
|
-
|
|
26486
|
+
(e.color.theme != null
|
|
26487
|
+
? (fontColor = vu("color").attr("theme", e.color.theme),
|
|
26488
|
+
e.color.tint != null && fontColor.attr("tint", e.color.tint),
|
|
26489
|
+
t.append(fontColor))
|
|
26476
26490
|
: e.color.rgb &&
|
|
26477
|
-
t.append(vu("color").attr("rgb", e.color.rgb))),
|
|
26491
|
+
t.append(vu("color").attr("rgb", e.color.rgb.length === 6 ? "FF" + e.color.rgb : e.color.rgb))),
|
|
26478
26492
|
this.$fonts.append(t);
|
|
26479
26493
|
t = this.$fonts.children().length;
|
|
26480
26494
|
return this.$fonts.attr("count", t), t - 1;
|
|
@@ -26498,7 +26512,7 @@ function make_xlsx_lib(a) {
|
|
|
26498
26512
|
return this.$numFmts.attr("count", e), r;
|
|
26499
26513
|
},
|
|
26500
26514
|
_addFill: function (e) {
|
|
26501
|
-
if (!e) return 0;
|
|
26515
|
+
if (!e || (!e.patternType && !e.fgColor && !e.bgColor)) return 0;
|
|
26502
26516
|
var t,
|
|
26503
26517
|
r = vu("patternFill").attr("patternType", e.patternType || "solid");
|
|
26504
26518
|
e.fgColor &&
|
|
@@ -26508,7 +26522,7 @@ function make_xlsx_lib(a) {
|
|
|
26508
26522
|
(e.fgColor.rgb = "FF" + e.fgColor.rgb),
|
|
26509
26523
|
t.attr("rgb", e.fgColor.rgb),
|
|
26510
26524
|
r.append(t))
|
|
26511
|
-
: e.fgColor.theme &&
|
|
26525
|
+
: e.fgColor.theme != null &&
|
|
26512
26526
|
(t.attr("theme", e.fgColor.theme),
|
|
26513
26527
|
e.fgColor.tint && t.attr("tint", e.fgColor.tint),
|
|
26514
26528
|
r.append(t)),
|
|
@@ -26529,7 +26543,7 @@ function make_xlsx_lib(a) {
|
|
|
26529
26543
|
t.color.auto
|
|
26530
26544
|
? e.attr("auto", t.color.auto)
|
|
26531
26545
|
: t.color.rgb
|
|
26532
|
-
? e.attr("rgb", t.color.rgb)
|
|
26546
|
+
? e.attr("rgb", t.color.rgb.length === 6 ? "FF" + t.color.rgb : t.color.rgb)
|
|
26533
26547
|
: (t.color.theme || t.color.tint) &&
|
|
26534
26548
|
(e.attr("theme", t.color.theme || "1"),
|
|
26535
26549
|
e.attr("tint", t.color.tint || "0")),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* xlsx-js-style 1.2.0-beta @ 2022-04-05T01:40:40.843Z */
|
|
2
|
+
/* Modified by Shahrom Shukurov: page setup and sheet_to_json style collection in the bundled writer; local formatting. See NOTICE. */
|
|
2
3
|
var XLSX = {};
|
|
3
4
|
function make_xlsx_lib(a) {
|
|
4
5
|
(a.version = "0.18.5"), (a.style_version = "1.2.0");
|
|
@@ -14426,8 +14427,8 @@ function make_xlsx_lib(a) {
|
|
|
14426
14427
|
(r = (function (e, t, r, a) {
|
|
14427
14428
|
if (
|
|
14428
14429
|
(e.c && r["!comments"].push([t, e.c]),
|
|
14429
|
-
(void 0 === e.v && "string" != typeof e.f) ||
|
|
14430
|
-
("z" === e.t && !e.f))
|
|
14430
|
+
((void 0 === e.v && "string" != typeof e.f) ||
|
|
14431
|
+
("z" === e.t && !e.f)) && !e.s)
|
|
14431
14432
|
)
|
|
14432
14433
|
return "";
|
|
14433
14434
|
var n = "",
|
|
@@ -14457,6 +14458,8 @@ function make_xlsx_lib(a) {
|
|
|
14457
14458
|
var o = $t("v", kt(n)),
|
|
14458
14459
|
c = { r: t },
|
|
14459
14460
|
l = el(a.cellXfs, e, a);
|
|
14461
|
+
if (("z" === e.t && !e.f) || (null == e.v && "string" != typeof e.f))
|
|
14462
|
+
o = "";
|
|
14460
14463
|
switch ((0 !== l && (c.s = l), e.t)) {
|
|
14461
14464
|
case "n":
|
|
14462
14465
|
break;
|
|
@@ -26276,7 +26279,15 @@ function make_xlsx_lib(a) {
|
|
|
26276
26279
|
});
|
|
26277
26280
|
return (
|
|
26278
26281
|
(a.prototype.escapeAttributeValue = function (e) {
|
|
26279
|
-
return
|
|
26282
|
+
return (
|
|
26283
|
+
'"' +
|
|
26284
|
+
e
|
|
26285
|
+
.replace(/&(?!(?:amp|lt|gt|quot|apos|#[0-9]+|#x[0-9a-fA-F]+);)/g, "&")
|
|
26286
|
+
.replace(/</g, "<")
|
|
26287
|
+
.replace(/>/g, ">")
|
|
26288
|
+
.replace(/\"/g, """) +
|
|
26289
|
+
'"'
|
|
26290
|
+
);
|
|
26280
26291
|
}),
|
|
26281
26292
|
(a.prototype.toXml = function (e) {
|
|
26282
26293
|
// in this function make style tag
|
|
@@ -26456,12 +26467,15 @@ function make_xlsx_lib(a) {
|
|
|
26456
26467
|
},
|
|
26457
26468
|
_addFont: function (e) {
|
|
26458
26469
|
if (!e) return 0;
|
|
26470
|
+
var fontColor;
|
|
26459
26471
|
var t = vu("font")
|
|
26460
26472
|
.append(vu("sz").attr("val", e.sz || this.defaultStyle.font.sz))
|
|
26461
26473
|
.append(
|
|
26462
26474
|
vu("name").attr("val", e.name || this.defaultStyle.font.name)
|
|
26463
26475
|
);
|
|
26464
26476
|
e.bold && t.append(vu("b")),
|
|
26477
|
+
e.family != null && t.append(vu("family").attr("val", e.family)),
|
|
26478
|
+
e.scheme != null && t.append(vu("scheme").attr("val", e.scheme)),
|
|
26465
26479
|
e.underline && t.append(vu("u")),
|
|
26466
26480
|
e.italic && t.append(vu("i")),
|
|
26467
26481
|
e.strike && t.append(vu("strike")),
|
|
@@ -26469,12 +26483,12 @@ function make_xlsx_lib(a) {
|
|
|
26469
26483
|
e.shadow && t.append(vu("shadow")),
|
|
26470
26484
|
e.vertAlign && t.append(vu("vertAlign").attr("val", e.vertAlign)),
|
|
26471
26485
|
e.color &&
|
|
26472
|
-
(e.color.theme
|
|
26473
|
-
? (
|
|
26474
|
-
|
|
26475
|
-
|
|
26486
|
+
(e.color.theme != null
|
|
26487
|
+
? (fontColor = vu("color").attr("theme", e.color.theme),
|
|
26488
|
+
e.color.tint != null && fontColor.attr("tint", e.color.tint),
|
|
26489
|
+
t.append(fontColor))
|
|
26476
26490
|
: e.color.rgb &&
|
|
26477
|
-
t.append(vu("color").attr("rgb", e.color.rgb))),
|
|
26491
|
+
t.append(vu("color").attr("rgb", e.color.rgb.length === 6 ? "FF" + e.color.rgb : e.color.rgb))),
|
|
26478
26492
|
this.$fonts.append(t);
|
|
26479
26493
|
t = this.$fonts.children().length;
|
|
26480
26494
|
return this.$fonts.attr("count", t), t - 1;
|
|
@@ -26498,7 +26512,7 @@ function make_xlsx_lib(a) {
|
|
|
26498
26512
|
return this.$numFmts.attr("count", e), r;
|
|
26499
26513
|
},
|
|
26500
26514
|
_addFill: function (e) {
|
|
26501
|
-
if (!e) return 0;
|
|
26515
|
+
if (!e || (!e.patternType && !e.fgColor && !e.bgColor)) return 0;
|
|
26502
26516
|
var t,
|
|
26503
26517
|
r = vu("patternFill").attr("patternType", e.patternType || "solid");
|
|
26504
26518
|
e.fgColor &&
|
|
@@ -26508,7 +26522,7 @@ function make_xlsx_lib(a) {
|
|
|
26508
26522
|
(e.fgColor.rgb = "FF" + e.fgColor.rgb),
|
|
26509
26523
|
t.attr("rgb", e.fgColor.rgb),
|
|
26510
26524
|
r.append(t))
|
|
26511
|
-
: e.fgColor.theme &&
|
|
26525
|
+
: e.fgColor.theme != null &&
|
|
26512
26526
|
(t.attr("theme", e.fgColor.theme),
|
|
26513
26527
|
e.fgColor.tint && t.attr("tint", e.fgColor.tint),
|
|
26514
26528
|
r.append(t)),
|
|
@@ -26529,7 +26543,7 @@ function make_xlsx_lib(a) {
|
|
|
26529
26543
|
t.color.auto
|
|
26530
26544
|
? e.attr("auto", t.color.auto)
|
|
26531
26545
|
: t.color.rgb
|
|
26532
|
-
? e.attr("rgb", t.color.rgb)
|
|
26546
|
+
? e.attr("rgb", t.color.rgb.length === 6 ? "FF" + t.color.rgb : t.color.rgb)
|
|
26533
26547
|
: (t.color.theme || t.color.tint) &&
|
|
26534
26548
|
(e.attr("theme", t.color.theme || "1"),
|
|
26535
26549
|
e.attr("tint", t.color.tint || "0")),
|