rainforestyu / js-xlsx-angular-demo

A demo to show how using sheetjs to export xlsx using data or table

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular 4+

The library can be imported directly from TS code with:

import * as XLSX from 'xlsx';

This demo uses an array of arrays as the core data structure. The component template includes a file input element, a table that updates based on the data, and a button to export the data.

OR it can generate worksheet From Table Data,Threse way may use less code, but it limited by table data,like image,button,it will not able to export.

Switching between Angular versions

Please See SheetJS Site

SystemJS Configuration

The default angular-cli configuration requires no additional configuration.

Some deployments use the SystemJS loader, which does require configuration. The SystemJS example shows the required meta and map settings:

SystemJS.config({
	meta: {
		'xlsx': {
			exports: 'XLSX' // <-- tell SystemJS to expose the XLSX variable
		}
	},
	map: {
		'xlsx': 'xlsx.full.min.js', // <-- make sure xlsx.full.min.js is in same dir
		'fs': '',     // <--|
		'crypto': '', // <--| suppress native node modules
		'stream': ''  // <--|
	}
});

About

A demo to show how using sheetjs to export xlsx using data or table

License:Apache License 2.0


Languages

Language:TypeScript 72.1%Language:HTML 23.5%Language:Makefile 4.5%