forked from sheetjs/sheetjs
		
	
		
			
	
	
		
			71 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			71 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
|  | ## Installation
 | ||
|  | 
 | ||
|  | With [npm](https://www.npmjs.org/package/xlsx): | ||
|  | 
 | ||
|  | ```bash | ||
|  | $ npm install xlsx | ||
|  | ``` | ||
|  | 
 | ||
|  | In the browser: | ||
|  | 
 | ||
|  | ```html | ||
|  | <script lang="javascript" src="dist/xlsx.core.min.js"></script> | ||
|  | ``` | ||
|  | 
 | ||
|  | With [bower](http://bower.io/search/?q=js-xlsx): | ||
|  | 
 | ||
|  | ```bash | ||
|  | $ bower install js-xlsx | ||
|  | ``` | ||
|  | 
 | ||
|  | CDNjs automatically pulls the latest version and makes all versions available at | ||
|  | <http://cdnjs.com/libraries/xlsx> | ||
|  | 
 | ||
|  | ### JS Ecosystem Demos
 | ||
|  | 
 | ||
|  | The `demos` directory includes sample projects for: | ||
|  | 
 | ||
|  | - [`browserify`](http://browserify.org/) | ||
|  | - [`requirejs`](http://requirejs.org/) | ||
|  | - [`webpack`](https://webpack.js.org/) | ||
|  | 
 | ||
|  | ### Optional Modules
 | ||
|  | 
 | ||
|  | The node version automatically requires modules for additional features.  Some | ||
|  | of these modules are rather large in size and are only needed in special | ||
|  | circumstances, so they do not ship with the core.  For browser use, they must | ||
|  | be included directly: | ||
|  | 
 | ||
|  | ```html | ||
|  | <!-- international support from js-codepage --> | ||
|  | <script src="dist/cpexcel.js"></script> | ||
|  | ``` | ||
|  | 
 | ||
|  | An appropriate version for each dependency is included in the dist/ directory. | ||
|  | 
 | ||
|  | The complete single-file version is generated at `dist/xlsx.full.min.js` | ||
|  | 
 | ||
|  | Webpack and browserify builds include optional modules by default.  Webpack can | ||
|  | be configured to remove support with `resolve.alias`: | ||
|  | 
 | ||
|  | ```js | ||
|  |   /* uncomment the lines below to remove support */ | ||
|  |   resolve: { | ||
|  |     alias: { "./dist/cpexcel.js": "" } // <-- omit international support | ||
|  |   } | ||
|  | ``` | ||
|  | 
 | ||
|  | 
 | ||
|  | ### ECMAScript 5 Compatibility
 | ||
|  | 
 | ||
|  | Since xlsx.js uses ES5 functions like `Array#forEach`, older browsers require | ||
|  | [Polyfills](http://git.io/QVh77g).  This repo and the gh-pages branch include | ||
|  | [a shim](https://github.com/SheetJS/js-xlsx/blob/master/shim.js) | ||
|  | 
 | ||
|  | To use the shim, add the shim before the script tag that loads xlsx.js: | ||
|  | 
 | ||
|  | ```html | ||
|  | <script type="text/javascript" src="/path/to/shim.js"></script> | ||
|  | ``` | ||
|  | 
 |