Provides exporting support for @angular/material tables
  !Total Downloads
This package is to make MatTable components exportable in excel, csv, txt and json formats. Pagination is also supported. Applying MatTableExporter directive to your MatTable is enough to make it exportable. The directive uses different exporter services for different exporting types. You can also implement your own exporter and use it for your custom exporting requirements.
This project employs xlsx sheetjs, which is a great library and mature enough for the excel creation itself. In order to achieve a cross-browser file saving capability FileSaverjs is employed.
The MatTableExporter directive inside this package is a mini-cdk-table-exporter subtype and provides support for angular material's cdkTable.
mini-cdk-table-exporter facilitates the common exporting related functionalities for CdkTable implementations abstracting the behavior that can change among different CdkTables.
If you are employing angular material in your project. Install mini-mat-table-exporter
```
npm install --save mini-mat-table-exporter`
NOTE: For the previous major versions of Angular install version 1.2.5 `
npm install --save mini-mat-table-exporter@1.2.5
After installing mini-mat-table-exporter import MatTableExporterModule in your ngModule
``
import { MatTableExporterModule } from 'mini-mat-table-exporter';
Install mini-cdk-table-exporter if you are not using angular material in your project. In this case you have to implement your version of CdkTableExporter abstract class to use as your directive.
``
npm install --save mini-cdk-table-exporter`
NOTE: For the previous major versions of Angular install version 1.2.5`
npm install --save mini-cdk-table-exporter@1.2.5
After installing mini-cdk-table-exporter import CdkTableExporterModule in your ngModules
``
import { CdkTableExporterModule } from 'mini-cdk-table-exporter';
matTableExporter is the directive selector.`html`
`html`
##### * Stackblitz demo: mte-demo.
##### * Stackblitz demo of custom exporter mte-cex-demo.
##API
| Input/Output | Property | Type | Description |
| --- | --- | --- | --- |
| @Input | hiddenColumns | Array | (Optional) The indexes of the columns that are not wanted in the output file |@Input
| | exporter | Exporter | (Optional) The actual exporting implementation that defines the strategy to be applied to the rows extracted from MatTable. |@Output
| | exportStarted | EventEmitter | (Optional) Event that's fired when the export started |@Output
| | exportCompleted | EventEmitter | (Optional) Event that's fired when the export completed |
| Method | Description |
|----------|-------------|
| exportTable(exportType?: ExportType, options?: Options) | Called to trigger the export of MatTable|
`js`
export enum ExportType {
XLS = 'xls',
XLSX = 'xlsx',
CSV = 'csv',
TXT = 'txt',
JSON = 'json',
OTHER = 'other'
}
| Property | Type | Description |
|----------|--------|-------------|
| fileName | string |(Optional) Name of the exported file|
| Property | Type | Description |
|----------|--------|-------------|
| fileName | string |(Optional) Name of the exported file|'base64', 'binary', 'buffer', 'file', 'array', 'string'
| type | |(Optional) Output data encoding|boolean
| bookSST | |(Optional) Generate Shared String Table @default false|string
| sheet | |(Optional) Name of the exported sheet|boolean
| compression | |(Optional) Use ZIP compression for ZIP-based formats @default false|boolean
| ignoreEC | |(Optional) Suppress "number stored as text" errors in generated files @default true|Properties
| Props | |(Optional) Workbook properties like Author, Title, Subject etc.|Array
| columnWidths |
Apache-2.0