Jexcel with Angular

Installing jExcel in an angular project

%npm install jexcel-pro

Running Example:

Click here to see the project running on codesandbox.



Source code

import { Component, ViewChild, ElementRef } from "@angular/core";
import * as jexcel from "jexcel-pro";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  @ViewChild("spreadsheet") spreadsheet: ElementRef;
  title = "CodeSandbox";

  ngAfterViewInit() {
    jexcel(this.spreadsheet.nativeElement, {
      data: [[]],
      columns: [
        { type: "dropdown", width: "100px", source: ["Y", "N"] },
        { type: "color", width: "100px", render: "square" }
      ],
      minDimensions: [10, 10]
    });
  }
}

NOTE: Make sure to import the jexcel.css in your angular.json

"styles": ["styles.css","./node_modules/jexcel-pro/dist/jexcel.css"],


Base angular project using jexcel

View source