Giter Site home page Giter Site logo

angular-xlsx-model's Introduction

angular-xlsx-model

Angular directive to convert XLSX files into JSON directly into the model.

Not compatible with Internet Explorer. It doesn't support JS readAsBinaryString. Will not fix.

Usage

Install with bower:

bower install angular-xlsx-model --save

Add to your HTML files:

<script src='/bower_components/xlsx-model/xlsx-model.js'></script>

Inject the directive to your angular application:

angular.module('myApp', ['xlsx-model']);

Start using:

index.html:

<input type='file' xlsx-model='excel'>
<pre>{{excel | json}}</pre>

Demo

Check this Plunker: http://plnkr.co/edit/inETA0PcxIkm4EmS9qjD?p=preview.

Author

© 2016, Helvio Pedreschi <[email protected]>.

License

The files are licensed under the MIT terms.

angular-xlsx-model's People

Contributors

helvio88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

angular-xlsx-model's Issues

Internet Explorer Compability Issue for readAsBinaryString function

I figured out how to solve Internet Explorer compability issue.

You have to add following script for extend FileReader.readAsBinaryString function to head of your html page.
if (FileReader.prototype.readAsBinaryString === undefined) { FileReader.prototype.readAsBinaryString = function (fileData) { var binary = ""; var pt = this; var reader = new FileReader(); reader.onload = function (e) { var bytes = new Uint8Array(reader.result); var length = bytes.byteLength; for (var i = 0; i < length; i++) { binary += String.fromCharCode(bytes[i]); } pt.content = binary; $(pt).trigger('onload'); } reader.readAsArrayBuffer(fileData); } }
After that in xlsx-model.js file; you should add the following lines after onload functions.
if (!file) { var data1 = reader.content; } else { var data1 = file.target.result; }

I combined it with the information on this page.
It gave a successful result.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.