Saturday, July 29, 2023

How to export Excel in Anulgar Demo Example

 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

How to build an Express and Node.js app with Typescript

  In this tutorial, you will learn how to set up a Node.js and Express project with Typescript and live auto-reloading. Note that this metho...