style-xlsx-m 0.1.9 → 0.1.11
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 +40 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,46 @@ Install browser:
|
|
|
31
31
|
- Current version of sheetjs used: **0.18.5**
|
|
32
32
|
- Over time, will be added new and customized features.
|
|
33
33
|
|
|
34
|
+
|
|
35
|
+
## 🗒 What I added?
|
|
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
|
+
- Step 1:
|
|
61
|
+
'./excample.xlsx' - is a path to your excel file.
|
|
62
|
+
Second property is a option { cellStyle: true } for get cells style (but now can't get in xls format).
|
|
63
|
+
|
|
64
|
+
- Step 2:
|
|
65
|
+
Create data rows worksheet
|
|
66
|
+
|
|
67
|
+
- Step 3:
|
|
68
|
+
Get workbook data with style and set workbook.Sheets.sheetname to worksheet
|
|
69
|
+
|
|
70
|
+
- Step 4:
|
|
71
|
+
Save your file (xlsm and xls are format for save macros)
|
|
72
|
+
|
|
73
|
+
|
|
34
74
|
## 🗒 Style API
|
|
35
75
|
-- Method to export file in excel with style get from [xlsx-js-style](https://www.npmjs.com/package/xlsx-js-style) (only function writeFile)
|
|
36
76
|
|