Pages
- Export tabe Excel in Asp.net
- CSS
- Date Picker in Jquery
- SQL
- Sort Self Code
- JavaScript(Print Page)
- Web Services Part-4(How to make changes to wcf ser...
- WCF Services Part-3( WCF service implementing mult...
- Home
- WCF Services Part-2(configuration web.config)
- WCF Services Part-1
- Web Services part-1 (introduction)
- Web Service PART-5 ( Call Web Service using JQuery...
- Web Service PART-4 ( Calling asp net web service f...
- Web Service PART-3 (WebMethod attribute properties...
- Web Service PART-2 (Session State )
Tuesday, 1 December 2020
download exel angular 4
import { ExcelService } from '../service/excel.service';
constructor(private excelService: ExcelService, ){}
exportAsXLSX(dataJSON): void {
this.excelService.exportAsExcelFile(dataJSON, 'sample');
}
=========================Service
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({
providedIn: 'root'
})
export class ExcelService {
constructor() { }
public exportAsExcelFile(json: any[], excelFileName: string): void {
const worksheet: XLSX.WorkSheet = XLSX.utils.json_to_sheet(json);
console.log('worksheet',worksheet);
const workbook: XLSX.WorkBook = { Sheets: { 'data': worksheet }, SheetNames: ['data'] };
const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
// //const excelBuffer: any = XLSX.write(workbook, { bookType: 'xlsx', type: 'buffer' });
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);
}
}
====App.module
import { ExcelService } from './service/excel.service';
providers: [ExcelService],
Subscribe to:
Post Comments (Atom)
IIS deployment support details
Node JS - IIS deployment support details node: http://go.microsoft.com/?linkid=9784334 IISNode: https://github.com/azure/iisnode/releases/...
Pages
- Home
- Export tabe Excel in Asp.net
- CSS
- Sort Self Code
- SQL
- JavaScript(Print Page)
- Date Picker in Jquery
- WCF Services Part-3( WCF service implementing mult...
- Web Services Part-4(How to make changes to wcf ser...
- WCF Services Part-2(configuration web.config)
- WCF Services Part-1
- Web Services part-1 (introduction)
- Web Service PART-5 ( Call Web Service using JQuery...
- Web Service PART-4 ( Calling asp net web service f...
- Web Service PART-3 (WebMethod attribute properties...
- Web Service PART-2 (Session State )
-
@ NgModule ({ declarations: [ GrdFilterPipe ] }) import { Pipe , PipeTransform } from '@angular/core' ; @ Pipe...
-
======Angular onFileChange(event: any) { var reader: any = new FileReader(); if (event.target.files && event.target.files.l...
-
public void MailSant( string Subject, string message_text, string to1) { //------------ Mail Code Start here .....
No comments:
Post a Comment