style-xlsx-m 0.1.8 → 0.1.10
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/README.md +48 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## ℹ️ About
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Style-xlsx-m is a custom [XLSX](https://www.npmjs.com/package/xlsx) (SheetJs) version library with styling from [xlsx-js-style](https://www.npmjs.com/package/xlsx-js-style)
|
|
6
6
|
|
|
7
|
-
<p align="center">
|
|
8
|
-
<a href="https://github.com/gitbrent/xlsx-js-style/">
|
|
9
|
-
<img alt="style-xlsx-m sheetjs styles" title="style-xlsx-m sheetjs styles" src="https://github.com/gitbrent/xlsx-js-style/blob/7664a045cd8f96b6b1b92ad563babebb8d6e0b4a/demos/browser/images/readme_banner.png"/>
|
|
10
|
-
</a>
|
|
11
|
-
</p>
|
|
12
|
-
<br/>
|
|
13
7
|
|
|
14
8
|
## 🔌 Installation
|
|
15
9
|
|
|
@@ -35,10 +29,51 @@ Install browser:
|
|
|
35
29
|
|
|
36
30
|
- Refer to the [SheetJS](https://sheetjs.com/) documentation for core API reference
|
|
37
31
|
- Current version of sheetjs used: **0.18.5**
|
|
38
|
-
- Over time, new
|
|
32
|
+
- Over time, will be added new and customized features.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## 🗒 What did I add
|
|
36
|
+
-- 1 When you use read or readFile (second put type:'file') your file style-xlsx-m get cells style.
|
|
37
|
+
|
|
38
|
+
### read or readFile
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
// STEP 1
|
|
42
|
+
const workbook = XLSX.readFile('./example.xlsx',{ cellStyles: true, bookVBA: true });
|
|
43
|
+
|
|
44
|
+
// STEP 2
|
|
45
|
+
let worksheet = [
|
|
46
|
+
"!col":[ { wpx: 10 }, { wpx: 15 }, { wpx:30 } ]
|
|
47
|
+
"!row":[ { hpx: 10 }, { hpx: 15 }, { hpx:30 } ]
|
|
48
|
+
{ v: "line\nbreak", t: "s" },
|
|
49
|
+
{ v: "Courier: 24", t: "s" },
|
|
50
|
+
{ v: 45, t: "n" },
|
|
51
|
+
{ v: 2023, t: "n" },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
// STEP 3
|
|
55
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, false, false, sheetname);
|
|
56
|
+
|
|
57
|
+
// STEP 4
|
|
58
|
+
XLSX.writeFile(wb, "style-xlsx-m-example.xlsm");
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
-- Step 1:
|
|
62
|
+
'./excample.xlsx' - is a path to your excel file.
|
|
63
|
+
Second property is a option { cellStyle: true } for get cells style (but now can't get in xls format).
|
|
64
|
+
|
|
65
|
+
-- Step 2:
|
|
66
|
+
Create data rows worksheet
|
|
67
|
+
|
|
68
|
+
-- Step 3:
|
|
69
|
+
Get workbook data with style and set workbook.Sheets.sheetname to worksheet
|
|
70
|
+
|
|
71
|
+
-- Step 4:
|
|
72
|
+
Save your file (xlsm and xls are format for save macros)
|
|
73
|
+
|
|
39
74
|
|
|
40
75
|
## 🗒 Style API
|
|
41
|
-
-- Method to
|
|
76
|
+
-- Method to export file in excel with style get from [xlsx-js-style](https://www.npmjs.com/package/xlsx-js-style) (only function writeFile)
|
|
42
77
|
|
|
43
78
|
### Cell Style Example
|
|
44
79
|
|
|
@@ -133,12 +168,15 @@ Borders for merged areas are specified for each cell within the merged area. For
|
|
|
133
168
|
|
|
134
169
|
## 🙏 Thanks
|
|
135
170
|
|
|
136
|
-
This project is a fork of [SheetJS/sheetjs](https://github.com/sheetjs/sheetjs) combined with code from
|
|
171
|
+
This project is a fork of [SheetJS/sheetjs](https://github.com/sheetjs/sheetjs) combined with code and documentation from
|
|
137
172
|
[xlsx-js-style](https://www.npmjs.com/package/xlsx-js-style) (by [brentely](https://www.npmjs.com/~brentely)).
|
|
138
173
|
|
|
139
174
|
All projects are under the Apache 2.0 License
|
|
140
175
|
|
|
141
176
|
- [sheetjs](https://github.com/SheetJS/sheetjs)
|
|
177
|
+
- [js-xlsx](https://github.com/protobi/js-xlsx)
|
|
178
|
+
- [sheetjs-style](https://www.npmjs.com/package/sheetjs-style)
|
|
179
|
+
- [sheetjs-style-v2](https://www.npmjs.com/package/sheetjs-style-v2)
|
|
142
180
|
- [xlsx-js-style](https://www.npmjs.com/package/xlsx-js-style)
|
|
143
181
|
|
|
144
182
|
## 🔖 License
|