#ionic-framework #xlsx
Вопрос:
Я получаю ниже ошибку при запуске проекта ionic: я получаю ошибку при создании приложения Ionic 3
import { Injectable } from '@angular/core';
import * as FileSaver from 'file-saver';
import * as XLSX from 'xlsx';
const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
const EXCEL_EXTENSION = '.xlsx';
@Injectable()
export class ExcelService {
constructor() { }
public exportAsExcelFile(data: any[], excelFileName: string): void {
const worksheet = utils.table_to_sheet(data);
const workbook:XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] };
const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
this.saveAsExcelFile(excelBuffer, excelFileName);
}
private saveAsExcelFile(buffer: any, fileName: string): void {
const data: Blob = new Blob([buffer], {type: EXCEL_TYPE});
FileSaver.saveAs(data, fileName '_export_' new Date().getTime() EXCEL_EXTENSION);
}
}
Получение приведенной ниже ошибки, отображаемой при сборке ionic
[10:54:44] typescript: ...MOD/Solitaire App 37/solitaireapp(salseAPP) - 6-0/src/services/excel.service.ts, line: 11
**Module ''*'' has no exported member 'WorkSheet'.**
L10: public exportAsExcelFile(data, excelFileName: string): void {
L11: const worksheet:XLSX.WorkSheet= XLSX.utils.table_to_sheet(data.nativeElement);
L12: //const worksheet = utils.table_to_sheet(data);
[10:54:44] typescript: ...MOD/Solitaire App 37/solitaireapp(salseAPP) - 6-0/src/services/excel.service.ts, line: 13
**Module ''*'' has no exported member 'WorkBook'.**
L12: //const worksheet = utils.table_to_sheet(data);
L13: const workbook:XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] };
L14: const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });