Small library for generate xls files via Webworker

Excel Builder

Small library for generate xls files via Webworker

import { NgModule } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { ExcelBuilderModule } from '@angular-ru/ng-excel-builder';

@NgModule({
    imports: [TranslateModule.forRoot(), ExcelBuilderModule]
})
export class AppModule {}

About

This builder we made for simple and fast generation xls files on client-side. It works with small & medium data size. Files wil open only in Microsoft Excel(!). Google Spreadsheets, LibreOffice and another programs are not supported.

Install

$ npm install @angular-ru/ng-excel-builder --save

Example

import { Component } from '@angular/core';
import { ExcelService } from '@angular-ru/ng-excel-builder';

@Component()
export class AppComponent {
    public data = [
      {
        id: 'id',
        name: 'Maria',
        description: 'Fugiat tempor sunt nostrud ad fugiat. Laboris velit duis incididunt culpa',
        ...
      },
      {...}
    ];

    constructor(protected excel: ExcelService) {}

    public exportExcel(): void {
        this.excel.exportExcel({
            filename: 'TITLE',
            worksheets: [
                {
                    titleKey: 'MODEL_KEY_NAME',
                    worksheetName: 'worksheet name',
                    table: this.data
                }
            ],
            translateColumns: {  // Example by RU
               MODEL_KEY_NAME: {
                    id: 'id',
                    name: 'Имя',
                    description: 'Описание'
               }
            }
        });
    }
}
  • “filename” - the generated file will be named like this.
  • “worksheets” - array of objects with your data.
    • titleKey will be used in translate function.
    • worksheetName - name of the sheet.
    • table is array of objects, which contains data for sheet.
  • “translateColumns” - it’s a dictionary for you column headers, you can leave it empty and then the column keys will be generated as is.

Download Details:

Author: Angular-RU

Demo: https://angular-ru.github.io/angular-ru-excel-example-app/

Source Code: https://github.com/Angular-RU/angular-ru-excel-example-app

#angularjs #javascript #angular

Small library for generate xls files via Webworker
11.45 GEEK