@slickgrid-universal/excel-export 4.7.0 → 5.0.0-beta.1
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 +81 -81
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -6
- package/src/excelExport.service.ts +640 -640
- package/src/excelUtils.ts +287 -287
package/README.md
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
[](https://opensource.org/licenses/MIT)
|
|
2
|
-
[](http://www.typescriptlang.org/)
|
|
3
|
-
[](https://github.com/ghiscoding/lerna-lite)
|
|
4
|
-
[](https://www.npmjs.com/package/@slickgrid-universal/excel-export)
|
|
5
|
-
[](https://www.npmjs.com/package/@slickgrid-universal/excel-export)
|
|
6
|
-
|
|
7
|
-
[](https://github.com/ghiscoding/slickgrid-universal/actions)
|
|
8
|
-
[](https://www.cypress.io/)
|
|
9
|
-
[](https://github.com/facebook/jest)
|
|
10
|
-
[](https://codecov.io/gh/ghiscoding/slickgrid-universal)
|
|
11
|
-
|
|
12
|
-
## Excel Export Service
|
|
13
|
-
#### @slickgrid-universal/excel-export
|
|
14
|
-
|
|
15
|
-
Simple Export to Excel Service that allows to exporting as `.xls` or `.xlsx`.
|
|
16
|
-
|
|
17
|
-
### Internal Dependencies
|
|
18
|
-
- [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)
|
|
19
|
-
- [@slickgrid-universal/utils](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/utils)
|
|
20
|
-
|
|
21
|
-
### External Dependencies
|
|
22
|
-
This package requires [excel-builder-vanilla](https://www.npmjs.com/package/excel-builder-vanilla) which itself also has a single dependency [fflate](https://www.npmjs.com/package/fflate) to compress the data before sending it to the browser.
|
|
23
|
-
|
|
24
|
-
### Installation
|
|
25
|
-
Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation), you can see a demo by looking at the [GitHub Demo](https://ghiscoding.github.io/slickgrid-universal/#/example02) page and click on "Export to Excel" from the Context Menu or the Grid Menu (aka hamburger menu).
|
|
26
|
-
|
|
27
|
-
You can also use nearly all Excel-Builder-Vanilla options, see their [Excel-Builder-Vanilla - Documentation](https://ghiscoding.gitbook.io/excel-builder-vanilla/) and also take a look at Slickgrid-Universal [Excel Export - Documentation](https://ghiscoding.gitbook.io/slickgrid-universal/grid-functionalities/export-to-excel) on how to use both.
|
|
28
|
-
|
|
29
|
-
### Usage
|
|
30
|
-
In order to use the Service, you will need to register it in your grid options via the `registerExternalResources` as shown below.
|
|
31
|
-
|
|
32
|
-
##### ViewModel
|
|
33
|
-
```ts
|
|
34
|
-
import { ExcelExportService } from '@slickgrid-universal/excel-export';
|
|
35
|
-
|
|
36
|
-
export class MyExample {
|
|
37
|
-
initializeGrid {
|
|
38
|
-
this.gridOptions = {
|
|
39
|
-
enableExcelExport: true,
|
|
40
|
-
excelExportOptions: {
|
|
41
|
-
sanitizeDataExport: true
|
|
42
|
-
},
|
|
43
|
-
externalResources: [new ExcelExportService()],
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
If you wish to reference the service to use it with external export button, then simply create a reference while instantiating it.
|
|
50
|
-
```ts
|
|
51
|
-
import { ExcelExportService } from '@slickgrid-universal/excel-export';
|
|
52
|
-
|
|
53
|
-
export class MyExample {
|
|
54
|
-
excelExportService: ExcelExportService;
|
|
55
|
-
|
|
56
|
-
constructor() {
|
|
57
|
-
this.excelExportService = new ExcelExportService();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
initializeGrid {
|
|
61
|
-
this.gridOptions = {
|
|
62
|
-
enableExcelExport: true,
|
|
63
|
-
excelExportOptions: {
|
|
64
|
-
sanitizeDataExport: true
|
|
65
|
-
},
|
|
66
|
-
externalResources: [this.excelExportService],
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
exportToExcel() {
|
|
71
|
-
this.excelExportService.exportToExcel({ filename: 'export', format: FileType.xlsx });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### CSP (Content Security Policy)
|
|
77
|
-
Please note that this Excel Export service is using `fflate` (it compresses the data before sending it to the browser) and for better performance it uses Web Workers and for that reason you might need to adjust your CSP rules. You simply need to add a CSP rule to avoid the error `worker-src 'self' blob:;`
|
|
78
|
-
|
|
79
|
-
```html
|
|
80
|
-
<meta http-equiv="Content-Security-Policy"
|
|
81
|
-
content="default-src 'self'; ...other rules... worker-src 'self' blob:;" />
|
|
1
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
|
+
[](http://www.typescriptlang.org/)
|
|
3
|
+
[](https://github.com/ghiscoding/lerna-lite)
|
|
4
|
+
[](https://www.npmjs.com/package/@slickgrid-universal/excel-export)
|
|
5
|
+
[](https://www.npmjs.com/package/@slickgrid-universal/excel-export)
|
|
6
|
+
|
|
7
|
+
[](https://github.com/ghiscoding/slickgrid-universal/actions)
|
|
8
|
+
[](https://www.cypress.io/)
|
|
9
|
+
[](https://github.com/facebook/jest)
|
|
10
|
+
[](https://codecov.io/gh/ghiscoding/slickgrid-universal)
|
|
11
|
+
|
|
12
|
+
## Excel Export Service
|
|
13
|
+
#### @slickgrid-universal/excel-export
|
|
14
|
+
|
|
15
|
+
Simple Export to Excel Service that allows to exporting as `.xls` or `.xlsx`.
|
|
16
|
+
|
|
17
|
+
### Internal Dependencies
|
|
18
|
+
- [@slickgrid-universal/common](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/common)
|
|
19
|
+
- [@slickgrid-universal/utils](https://github.com/ghiscoding/slickgrid-universal/tree/master/packages/utils)
|
|
20
|
+
|
|
21
|
+
### External Dependencies
|
|
22
|
+
This package requires [excel-builder-vanilla](https://www.npmjs.com/package/excel-builder-vanilla) which itself also has a single dependency [fflate](https://www.npmjs.com/package/fflate) to compress the data before sending it to the browser.
|
|
23
|
+
|
|
24
|
+
### Installation
|
|
25
|
+
Follow the instruction provided in the main [README](https://github.com/ghiscoding/slickgrid-universal#installation), you can see a demo by looking at the [GitHub Demo](https://ghiscoding.github.io/slickgrid-universal/#/example02) page and click on "Export to Excel" from the Context Menu or the Grid Menu (aka hamburger menu).
|
|
26
|
+
|
|
27
|
+
You can also use nearly all Excel-Builder-Vanilla options, see their [Excel-Builder-Vanilla - Documentation](https://ghiscoding.gitbook.io/excel-builder-vanilla/) and also take a look at Slickgrid-Universal [Excel Export - Documentation](https://ghiscoding.gitbook.io/slickgrid-universal/grid-functionalities/export-to-excel) on how to use both.
|
|
28
|
+
|
|
29
|
+
### Usage
|
|
30
|
+
In order to use the Service, you will need to register it in your grid options via the `registerExternalResources` as shown below.
|
|
31
|
+
|
|
32
|
+
##### ViewModel
|
|
33
|
+
```ts
|
|
34
|
+
import { ExcelExportService } from '@slickgrid-universal/excel-export';
|
|
35
|
+
|
|
36
|
+
export class MyExample {
|
|
37
|
+
initializeGrid {
|
|
38
|
+
this.gridOptions = {
|
|
39
|
+
enableExcelExport: true,
|
|
40
|
+
excelExportOptions: {
|
|
41
|
+
sanitizeDataExport: true
|
|
42
|
+
},
|
|
43
|
+
externalResources: [new ExcelExportService()],
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If you wish to reference the service to use it with external export button, then simply create a reference while instantiating it.
|
|
50
|
+
```ts
|
|
51
|
+
import { ExcelExportService } from '@slickgrid-universal/excel-export';
|
|
52
|
+
|
|
53
|
+
export class MyExample {
|
|
54
|
+
excelExportService: ExcelExportService;
|
|
55
|
+
|
|
56
|
+
constructor() {
|
|
57
|
+
this.excelExportService = new ExcelExportService();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
initializeGrid {
|
|
61
|
+
this.gridOptions = {
|
|
62
|
+
enableExcelExport: true,
|
|
63
|
+
excelExportOptions: {
|
|
64
|
+
sanitizeDataExport: true
|
|
65
|
+
},
|
|
66
|
+
externalResources: [this.excelExportService],
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exportToExcel() {
|
|
71
|
+
this.excelExportService.exportToExcel({ filename: 'export', format: FileType.xlsx });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### CSP (Content Security Policy)
|
|
77
|
+
Please note that this Excel Export service is using `fflate` (it compresses the data before sending it to the browser) and for better performance it uses Web Workers and for that reason you might need to adjust your CSP rules. You simply need to add a CSP rule to avoid the error `worker-src 'self' blob:;`
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<meta http-equiv="Content-Security-Policy"
|
|
81
|
+
content="default-src 'self'; ...other rules... worker-src 'self' blob:;" />
|
|
82
82
|
```
|