angularexcellentexport
v1.0.6
Published
AngularExcellentExport is a client-side Typescript library for exporting data to Excel. It provides functionality for creating Excel and CSV files on the client side.
Downloads
27
Maintainers
Readme
AngularExcellentExport
AngularExcellentExport is a client-side Typescript library for exporting data to Excel. It provides functionality for creating Excel and CSV files on the client side.
Author
- Himanshu Chauhan
Usage
1. **Installation:**
Install AngularExcellentExport using npm:
``` npm install angularexcellentexport --save```
### Javascript or Typescript Integration
// Import AngularExcellentExport
import { AngularExcellentExport } from 'angularexcellentexport';
// Example usage for Excel export
const excelAnchor = document.getElementById('excel-export-link');
const excelTable = document.getElementById('table-to-export');
AngularExcellentExport().excel(excelAnchor, excelTable, 'WorksheetName');
// Example usage for CSV export
const csvAnchor = document.getElementById('csv-export-link');
const csvTable = document.getElementById('table-to-export');
AngularExcellentExport().csv(csvAnchor, csvTable, ',', '\r\n');
### Angular Integration
// Example usage for Excel export in an Angular component
import { AngularExcellentExport } from 'angularexcellentexport';
@Component({
selector: 'app-root',
template: `
<table id="table-to-export">
<tr>
<th>Name</th>
<th>Age</th>
<th>Country</th>
</tr>
<tr>
<td>Himanshu Chauhan</td>
<td>22</td>
<td>India</td>
</tr>
</table>
<a href="#" #elementRefExcel (click)="exportToExcel(elementRefExcel,'table-to-export','WorksheetName')">Download Excel</a>
<a href="#" #elementRefCsv (click)="exportToCSV(elementRefCsv,'table-to-export')">Download CSV</a>
`,
})
export class AppComponent {
// Example Function for Excel export
exportToExcel(excelAnchor: any, excelTable: any, excelTableName: any) {
AngularExcellentExport().excel(excelAnchor, excelTable, excelTableName);
}
// Example Function for Csv export
exportToCSV(csvAnchor: any, csvTable: any) {
AngularExcellentExport().csv(csvAnchor, csvTable, ',');
}
}