Export Function check Below.
ngOnInit() {
setTimeout(() => this.staticAlertClosed = true, 20000);
this._success.subscribe((message) => this.successMessage = message);
this._success.pipe(
debounceTime(2000)
).subscribe(() => this.successMessage = null);
this.peopleByCity = [
{
city: 'Maplewood',
people: [
{ name: 'Logan', age: 10 },
{ name: 'Laurel', age: 11 }
]
},
{
city: 'South Orange',
people: [
{ name: 'Shayna', age: 39 },
{ name: 'Bobbie', age: 70 }
]
},
{
city: 'New York',
people: [
{ name: 'Big Ray', age: 48 },
{ name: 'Med. Ray', age: 16 },
{ name: 'Weenie', age: 10 },
{ name: 'Fishy', age: 13 }
]
}
];
}
public changeMessage() {
this._success.next(`${new Date()} - Message successfully changed.`);
}
exportJson(): void {
var res = alasql('SEARCH / AS @data \ people / AS @persons \ RETURN(@persons->name as Name, @persons->age as Age, @data->city AS City) \ FROM ?', [this.peopleByCity])
this.excelService.exportAsExcelFile(res, 'PeopleByCity');
}
No comments:
Post a Comment