Giter VIP home page Giter VIP logo

Comments (8)

redchair123 avatar redchair123 commented on May 4, 2024

Does it work with the browser demo http://oss.sheetjs.com/js-xls/ ?

If not, does it work with the command line tool? To get that, install node then npm install -g xlsjs and run xls2csv.

If it doesn't work in either place, can you send me the actual file?

from sheetjs.

cemiley avatar cemiley commented on May 4, 2024

Actually there is nothing with reading excel.The problem is the code block inside xls.js below break down another js functionality.For example my left menu doesn't work.

Code:
Array.prototype.readUInt8 = function(idx) { return this[idx]; };
Array.prototype.readUInt16LE = function(idx) { return this[idx+1](1<<8)+this[idx]; };
Array.prototype.readInt16LE = function(idx) { var u = this.readUInt16LE(idx); if(!(u & 0x8000)) return u; return (0xffff - u + 1) * -1; };
Array.prototype.readUInt32LE = function(idx) { return this[idx+3]
(1<<24)+this[idx+2](1<<16)+this[idx+1](1<<8)+this[idx]; };
Array.prototype.readInt32LE = function(idx) { var u = this.readUInt32LE(idx); if(!(u & 0x80000000)) return u; return (0xffffffff - u + 1) * -1; };
Array.prototype.readDoubleLE = function(idx) { return readIEEE754(this, idx||0);};

from sheetjs.

redchair123 avatar redchair123 commented on May 4, 2024

@cemiley the only prototype method involving split is the reverse function:

String.prototype.reverse=function(){return this.split("").reverse().join("");};

I will remove that from the prototype soon. In the interim, can you check if your code also adds a reverse prototype method to String?

from sheetjs.

cemiley avatar cemiley commented on May 4, 2024

@Niggler there is no reverse prototype method in my code

from sheetjs.

redchair123 avatar redchair123 commented on May 4, 2024

@cemiley are you possibly doing a for..in loop on an array? The prototype methods would show up there. For example:

> Array.prototype.readUInt8 = function(idx) { return this[idx]; };
[Function]
> for(y in [5,6,7]) console.log(y)
0
1
2
readUInt8

The correct way to do this loop is to put a guard:

> var x = [5,6,7]; for(y in x) if(x.hasOwnProperty(y)) console.log(y)
0
1
2

from sheetjs.

cemiley avatar cemiley commented on May 4, 2024

when i run in console for(y in [5,6,7]) console.log(y) the output is:

for(y in [5,6,7]) console.log(y)
0 VM460:2
1 VM460:2
2 VM460:2
readUInt8 VM460:2
readUInt16LE VM460:2
readInt16LE VM460:2
readUInt32LE VM460:2
readInt32LE VM460:2
readDoubleLE VM460:2
hexlify VM460:2
utf16le VM460:2
utf8 VM460:2
lpstr VM460:2
lpwstr VM460:2
toBuffer VM460:2
undefined

when i run var x = [5,6,7]; for(y in x) if(x.hasOwnProperty(y)) console.log(y)
the output is:

0 VM464:2
1 VM464:2
2 VM464:2
undefined

actually i couldn't understand what should i do ?

from sheetjs.

redchair123 avatar redchair123 commented on May 4, 2024

@cemiley you shouldn't be iterating over an array using for .. in syntax. Either use an iterative loop:

for(var i = 0; i != array.length; ++i) { /* use array[i] to access the object */ }

or use the functional forEach loop:

array.forEach(function(y) { /* y is the object here */ })

If you want a longer explanation, this answer on SO may be a good starting point

from sheetjs.

SheetJSDev avatar SheetJSDev commented on May 4, 2024

Related: #28

Issue has been resolved by removing all prototype methods.

from sheetjs.

Related Issues (20)

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.