Spread.Sheets can be used in an Angular project in the following way:
This method involves the following steps:
Open the Command Prompt window and type the following command:
npm install -g @angular/cli |
Next, you need to create a new project using the following command:
ng new spread-sheets-angular-cli |
Now, you can install the Spread.Sheets Npm package using the following commands:
npm install @grapecity/spread-sheets npm install @grapecity/spread-sheets-angular |
Now, you can configure the Spread.Sheets CSS in angular.json as shown below:
{ ... "projects":{ "spread-sheets-angular-cli":{ ... "architect":{ ... "build":{ ... options:{ ... "styles": [ "node_modules/@grapecity/spread-sheets/styles/gc.spread.sheets.excel2016darkGray.css" ], ... } ... } ... } ... } } ... } |
Now, you can modify the app.module.ts for importing the Spread.Sheets module as shown below:
import { BrowserModule } from '@angular/platform-browser'; @NgModule({ |
Now, you can modify the app.component.html for viewing the Spread.Sheets component as shown below:
<gc-spread-sheets [backColor]="spreadBackColor" [hostStyle]="hostStyle" (workbookInitialized)="workbookInit($event)"> |
Now, you can modify the app.component.ts for preparing data for Spread.Sheets component as shown below:
import { Component } from '@angular/core'; workbookInit(args){ |
Next, you can build and run the new project using the following command:
ng serve |
The following topics provide additional information about tag hierarchy and the Spread elements.