to-spreadsheet 1.1.2 → 1.1.4
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 +9 -3
- package/package.json +3 -3
- package/src/index.ts +0 -68
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# to-spreadsheet
|
|
2
|
-
npm package to create spreadsheet in node environment
|
|
2
|
+
npm package to create spreadsheet in node environment and in browser
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/to-spreadsheet)
|
|
@@ -19,7 +19,7 @@ npm i to-spreadsheet
|
|
|
19
19
|
[](https://codesandbox.io/s/to-spreadsheet-example-hdmrvc?file=/src/App.tsx)
|
|
20
20
|
|
|
21
21
|
```ts
|
|
22
|
-
import { generateExcel , EnvironmentType, skipCell } from 'to-spreadsheet/lib/index';
|
|
22
|
+
import { generateExcel , EnvironmentType, skipCell, writeEquation } from 'to-spreadsheet/lib/index';
|
|
23
23
|
|
|
24
24
|
const sampleData = [
|
|
25
25
|
{
|
|
@@ -28,7 +28,7 @@ const sampleData = [
|
|
|
28
28
|
['woof', 'smack'],
|
|
29
29
|
[1],
|
|
30
30
|
[1, 2],
|
|
31
|
-
[1, 2, 3],
|
|
31
|
+
[1, 2, 3, writeEquation('SUM(A5,C5)')],
|
|
32
32
|
]
|
|
33
33
|
},
|
|
34
34
|
{ title: 'Maifee2', content: [[1], [1, skipCell(3), 2]] },
|
|
@@ -38,3 +38,9 @@ const sampleData = [
|
|
|
38
38
|
generateExcel(sampleData); // <-- by default generate XLSX for node
|
|
39
39
|
generateExcel(sampleData, EnvironmentType.BROWSER); // <-- for browser
|
|
40
40
|
```
|
|
41
|
+
|
|
42
|
+
# Features
|
|
43
|
+
- [x] Multiple sheet support
|
|
44
|
+
- [x] Equations
|
|
45
|
+
- [ ] Cell styling
|
|
46
|
+
- [ ] Sheet styling
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "to-spreadsheet",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "npm package to create spreadsheet in node environment",
|
|
5
|
-
"main": "
|
|
3
|
+
"version": "1.1.4",
|
|
4
|
+
"description": "npm package to create spreadsheet in node environment and in browser",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepare": "npm run build",
|
|
8
8
|
"build": "tsc",
|
package/src/index.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { generateExcel, EnvironmentType } from "./generate-excel";
|
|
2
|
-
import { SkipCell, skipCell, Equation, writeEquation } from "./util";
|
|
3
|
-
|
|
4
|
-
enum ICellType {
|
|
5
|
-
string = "s",
|
|
6
|
-
number = "n",
|
|
7
|
-
skip = "skip",
|
|
8
|
-
equation = "equation",
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface ICellString {
|
|
12
|
-
type: ICellType.string;
|
|
13
|
-
value: number;
|
|
14
|
-
}
|
|
15
|
-
interface ICellNumber {
|
|
16
|
-
type: ICellType.number;
|
|
17
|
-
value: number;
|
|
18
|
-
}
|
|
19
|
-
interface ICellSkip {
|
|
20
|
-
type: ICellType.skip;
|
|
21
|
-
}
|
|
22
|
-
interface ICellEquation {
|
|
23
|
-
type: ICellType.equation;
|
|
24
|
-
value: Equation;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
type ICell = ICellString | ICellNumber | ICellSkip | ICellEquation;
|
|
28
|
-
|
|
29
|
-
interface IRows {
|
|
30
|
-
cells: ICell[];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface ISheet {
|
|
34
|
-
title: string;
|
|
35
|
-
rows: IRows[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface IWorkbook {
|
|
39
|
-
filename: string;
|
|
40
|
-
sheets: ISheet[];
|
|
41
|
-
strings: string[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface IPage {
|
|
45
|
-
title: string
|
|
46
|
-
content: (string | number | undefined | SkipCell | Equation)[][]
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { ICell, ISheet, IWorkbook, IRows, ICellType, IPage }
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const sampleData = [
|
|
53
|
-
{
|
|
54
|
-
title: 'Maifee1', content: [
|
|
55
|
-
['meaw', 'grrr'],
|
|
56
|
-
['woof', 'smack'],
|
|
57
|
-
[1],
|
|
58
|
-
[1, 2],
|
|
59
|
-
[1, 2, 3, writeEquation('SUM(A5,C5)')],
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
{ title: 'Maifee2', content: [[1], [1, skipCell(3), 2]] },
|
|
63
|
-
{ title: 'Maifee3', content: [['meaw', undefined, "meaw"], ["woof", 'woof']] }
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
// generateExcel(sampleData) // <- check before releasing with `yarn test:compile`
|
|
67
|
-
|
|
68
|
-
export { generateExcel, sampleData, EnvironmentType, skipCell, writeEquation };
|