2016-12-31 08:20:45 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-04-30 16:27:03 +00:00
var XLSX = { } ; ( function make _xlsx ( XLSX ) { XLSX . version = "0.9.13" ; var current _codepage = 1200 , current _cptable ; if ( typeof module !== "undefined" && typeof require !== "undefined" ) { if ( typeof cptable === "undefined" ) cptable = require ( "./dist/cpexcel.js" ) ; current _cptable = cptable [ current _codepage ] } function reset _cp ( ) { set _cp ( 1200 ) } var set _cp = function ( cp ) { current _codepage = cp } ; function char _codes ( data ) { var o = [ ] ; for ( var i = 0 , len = data . length ; i < len ; ++ i ) o [ i ] = data . charCodeAt ( i ) ; return o } var debom = function ( data ) { var c1 = data . charCodeAt ( 0 ) , c2 = data . charCodeAt ( 1 ) ; if ( c1 == 255 && c2 == 254 ) return data . substr ( 2 ) ; if ( c1 == 254 && c2 == 255 ) return data . substr ( 2 ) ; if ( c1 == 65279 ) return data . substr ( 1 ) ; return data } ; var _getchar = function _gc1 ( x ) { return String . fromCharCode ( x ) } ; if ( typeof cptable !== "undefined" ) { set _cp = function ( cp ) { current _codepage = cp ; current _cptable = cptable [ cp ] } ; debom = function ( data ) { if ( data . charCodeAt ( 0 ) === 255 && data . charCodeAt ( 1 ) === 254 ) { return cptable . utils . decode ( 1200 , char _codes ( data . substr ( 2 ) ) ) } return data } ; _getchar = function _gc2 ( x ) { if ( current _codepage === 1200 ) return String . fromCharCode ( x ) ; return cptable . utils . decode ( current _codepage , [ x & 255 , x >> 8 ] ) [ 0 ] } } var DENSE = null ; var DIF _XL = true ; var Base64 = function make _b64 ( ) { var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" ; return { encode : function ( input , utf8 ) { var o = "" ; var c1 , c2 , c3 , e1 , e2 , e3 , e4 ; for ( var i = 0 ; i < input . length ; ) { c1 = input . charCodeAt ( i ++ ) ; c2 = input . charCodeAt ( i ++ ) ; c3 = input . charCodeAt ( i ++ ) ; e1 = c1 >> 2 ; e2 = ( c1 & 3 ) << 4 | c2 >> 4 ; e3 = ( c2 & 15 ) << 2 | c3 >> 6 ; e4 = c3 & 63 ; if ( isNaN ( c2 ) ) { e3 = e4 = 64 } else if ( isNaN ( c3 ) ) { e4 = 64 } o += map . charAt ( e1 ) + map . charAt ( e2 ) + map . charAt ( e3 ) + map . charAt ( e4 ) } return o } , decode : function b64 _decode ( input , utf8 ) { var o = "" ; var c1 , c2 , c3 ; var e1 , e2 , e3 , e4 ; input = input . replace ( /[^A-Za-z0-9\+\/\=]/g , "" ) ; for ( var i = 0 ; i < input . length ; ) { e1 = map . indexOf ( input . charAt ( i ++ ) ) ; e2 = map . indexOf ( input . charAt ( i ++ ) ) ; e3 = map . indexOf ( input . charAt ( i ++ ) ) ; e4 = map . indexOf ( input . charAt ( i ++ ) ) ; c1 = e1 << 2 | e2 >> 4 ; c2 = ( e2 & 15 ) << 4 | e3 >> 2 ; c3 = ( e3 & 3 ) << 6 | e4 ; o += String . fromCharCode ( c1 ) ; if ( e3 != 64 ) { o += String . fromCharCode ( c2 ) } if ( e4 != 64 ) { o += String . fromCharCode ( c3 ) } } return o } } } ( ) ; var has _buf = typeof Buffer !== "undefined" && typeof process !== "undefined" && typeof process . versions !== "undefined" && process . versions . node ; function new _raw _buf ( len ) { return new ( has _buf ? Buffer : Array ) ( len ) } function s2a ( s ) { if ( has _buf ) return new Buffer ( s , "binary" ) ; return s . split ( "" ) . map ( function ( x ) { return x . charCodeAt ( 0 ) & 255 } ) } var bconcat = function ( bufs ) { return [ ] . concat . apply ( [ ] , bufs ) } ; var chr0 = /\u0000/g , chr1 = /[\u0001-\u0006]/ ; var SSF = { } ; var make _ssf = function make _ssf ( SSF ) { SSF . version = "0.9.1" ; function _strrev ( x ) { var o = "" , i = x . length - 1 ; while ( i >= 0 ) o += x . charAt ( i -- ) ; return o } function fill ( c , l ) { var o = "" ; while ( o . length < l ) o += c ; return o } function pad0 ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } function pad _ ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( " " , d - t . length ) + t } function rpad _ ( v , d ) { var t = "" + v ; return t . length >= d ? t : t + fill ( " " , d - t . length ) } function pad0r1 ( v , d ) { var t = "" + Math . round ( v ) ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } function pad0r2 ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } var p2 _32 = Math . pow ( 2 , 32 ) ; function pad0r ( v , d ) { if ( v > p2 _32 || v < - p2 _32 ) return pad0r1 ( v , d ) ; var i = Math . round ( v ) ; return pad0r2 ( i , d ) } function isgeneral ( s , i ) { i = i || 0 ; return s . length >= 7 + i && ( s . charCodeAt ( i ) | 32 ) === 103 && ( s . charCodeAt ( i + 1 ) | 32 ) === 101 && ( s . charCodeAt ( i + 2 ) | 32 ) === 110 && ( s . charCodeAt ( i + 3 ) | 32 ) === 101 && ( s . charCodeAt ( i + 4 ) | 32 ) === 114 && ( s . charCodeAt ( i + 5 ) | 32 ) === 97 && ( s . charCodeAt ( i + 6 ) | 32 ) === 108 } var opts _fmt = [ [ "date1904" , 0 ] , [ "output" , "" ] , [ "WTF" , false ] ] ; function fixopts ( o ) { for ( var y = 0 ; y != opts _fmt . length ; ++ y ) if ( o [ opts _fmt [ y ] [ 0 ] ] === undefined ) o [ opts _fmt [ y ] [ 0 ] ] = opts _fmt [ y ] [ 1 ] } SSF . opts = opts _fmt ; var days = [ [ "Sun" , "Sunday" ] , [ "Mon" , "Monday" ] , [ "Tue" , "Tuesday" ] , [ "Wed" , "Wednesday" ] , [ "Thu" , "Thursday" ] , [ "Fri" , "Friday" ] , [ "Sat" , "Saturday" ] ] ; var months = [ [ "J" , "Jan" , "January" ] , [ "F" , "Feb" , "February" ] , [ "M" , "Mar" , "March" ] , [ "A" , "Apr" , "April" ] , [ "M" , "May" , "May" ] , [ "J" , "Jun" , "June" ] , [ "J" , "Jul" , "July" ] , [ "A" , "Aug" , "August" ] , [ "S" , "Sep" , "September" ] , [ "O" , "Oct" , "October" ] , [ "N" , "Nov" , "November" ] , [ "D" , "Dec" , "December" ] ] ; function init _table ( t ) { t [ 0 ] = " Ge
var nsectors = Math . ceil ( file . length / ssz ) - 1 ; var sectors = new Array ( nsectors ) ; for ( var i = 1 ; i < nsectors ; ++ i ) sectors [ i - 1 ] = file . slice ( i * ssz , ( i + 1 ) * ssz ) ; sectors [ nsectors - 1 ] = file . slice ( nsectors * ssz ) ; return sectors } function build _full _paths ( FI , FPD , FP , Paths ) { var i = 0 , L = 0 , R = 0 , C = 0 , j = 0 , pl = Paths . length ; var dad = new Array ( pl ) , q = new Array ( pl ) ; for ( ; i < pl ; ++ i ) { dad [ i ] = q [ i ] = i ; FP [ i ] = Paths [ i ] } for ( ; j < q . length ; ++ j ) { i = q [ j ] ; L = FI [ i ] . L ; R = FI [ i ] . R ; C = FI [ i ] . C ; if ( dad [ i ] === i ) { if ( L !== - 1 && dad [ L ] !== L ) dad [ i ] = dad [ L ] ; if ( R !== - 1 && dad [ R ] !== R ) dad [ i ] = dad [ R ] } if ( C !== - 1 ) dad [ C ] = i ; if ( L !== - 1 ) { dad [ L ] = dad [ i ] ; q . push ( L ) } if ( R !== - 1 ) { dad [ R ] = dad [ i ] ; q . push ( R ) } } for ( i = 1 ; i !== pl ; ++ i ) if ( dad [ i ] === i ) { if ( R !== - 1 && dad [ R ] !== R ) dad [ i ] = dad [ R ] ; else if ( L !== - 1 && dad [ L ] !== L ) dad [ i ] = dad [ L ] } for ( i = 1 ; i < pl ; ++ i ) { if ( FI [ i ] . type === 0 ) continue ; j = dad [ i ] ; if ( j === 0 ) FP [ i ] = FP [ 0 ] + "/" + FP [ i ] ; else while ( j !== 0 ) { FP [ i ] = FP [ j ] + "/" + FP [ i ] ; j = dad [ j ] } dad [ i ] = 0 } FP [ 0 ] += "/" ; for ( i = 1 ; i < pl ; ++ i ) { if ( FI [ i ] . type !== 2 ) FP [ i ] += "/" ; FPD [ FP [ i ] ] = FI [ i ] } } function make _find _path ( FullPaths , Paths , FileIndex , files , root _name ) { var UCFullPaths = new Array ( FullPaths . length ) ; var UCPaths = new Array ( Paths . length ) , i ; for ( i = 0 ; i < FullPaths . length ; ++ i ) UCFullPaths [ i ] = FullPaths [ i ] . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; for ( i = 0 ; i < Paths . length ; ++ i ) UCPaths [ i ] = Paths [ i ] . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; return function find _path ( path ) { var k ; if ( path . charCodeAt ( 0 ) === 47 ) { k = true ; path = root _name + path } else k = path . indexOf ( "/" ) !== - 1 ; var UCPath = path . toUpperCase ( ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) ; var w = k === true ? UCFullPaths . indexOf ( UCPath ) : UCPaths . indexOf ( UCPath ) ; if ( w === - 1 ) return null ; return k === true ? FileIndex [ w ] : files [ Paths [ w ] ] } } function sleuth _fat ( idx , cnt , sectors , ssz , fat _addrs ) { var q ; if ( idx === ENDOFCHAIN ) { if ( cnt !== 0 ) throw new Error ( "DIFAT chain shorter than expected" ) } else if ( idx !== - 1 ) { var sector = sectors [ idx ] , m = ( ssz >>> 2 ) - 1 ; if ( ! sector ) return ; for ( var i = 0 ; i < m ; ++ i ) { if ( ( q = _ _readInt32LE ( sector , i * 4 ) ) === ENDOFCHAIN ) break ; fat _addrs . push ( q ) } sleuth _fat ( _ _readInt32LE ( sector , ssz - 4 ) , cnt - 1 , sectors , ssz , fat _addrs ) } } function get _sector _list ( sectors , start , fat _addrs , ssz , chkd ) { var sl = sectors . length ; var buf , buf _chain ; if ( ! chkd ) chkd = new Array ( sl ) ; var modulus = ssz - 1 , j , jj ; buf = [ ] ; buf _chain = [ ] ; for ( j = start ; j >= 0 ; ) { chkd [ j ] = true ; buf [ buf . length ] = j ; buf _chain . push ( sectors [ j ] ) ; var addr = fat _addrs [ Math . floor ( j * 4 / ssz ) ] ; jj = j * 4 & modulus ; if ( ssz < 4 + jj ) throw new Error ( "FAT boundary crossed: " + j + " 4 " + ssz ) ; if ( ! sectors [ addr ] ) break ; j = _ _readInt32LE ( sectors [ addr ] , jj ) } return { nodes : buf , data : _ _toBuffer ( [ buf _chain ] ) } } function make _sector _list ( sectors , dir _start , fat _addrs , ssz ) { var sl = sectors . length , sector _list = new Array ( sl ) ; var chkd = new Array ( sl ) , buf , buf _chain ; var modulus = ssz - 1 , i , j , k , jj ; for ( i = 0 ; i < sl ; ++ i ) { buf = [ ] ; k = i + dir _start ; if ( k >= sl ) k -= sl ; if ( chkd [ k ] === true ) continue ; buf _chain = [ ] ; for ( j = k ; j >= 0 ; ) { chkd [ j ] = true ; buf [ buf . length ] = j ; buf _chain . push ( sectors [ j ] ) ; var addr = fat _addrs [ Math . floor ( j * 4 / ssz ) ] ; jj = j * 4 & modulus ; if ( ssz < 4 + jj ) throw new Error ( "FAT boundary crossed: " + j + " 4 " + ssz ) ; if ( ! sectors [ addr ] ) break ; j = _ _readInt32LE ( sectors [ addr ] , jj ) } sector _list [ k ] = { nodes : buf , data : _ _toBuffer ( [ buf _chain ] ) } } return sector _list } function read _directory ( dir _start , sector _list , sectors , Paths , nmfs , files , FileIndex ) { var blob ; var minifat _store = 0 , pl = Paths . length ? 2 : 0 ; var sector = sector _list [ dir _start ] . data ; var i = 0 , namelen = 0 , name , o , ctime , mtime ; for ( ; i < sector . length ; i += 128 ) { blob = sector . slice ( i , i + 128 ) ; prep _blob ( blob , 64 ) ; namelen = blob . read _shift ( 2 ) ; if ( namelen === 0 ) continue ; name = _ _utf16le ( blob , 0 , namelen - pl ) ; Paths . push ( name ) ; o = { name : name , type : blob . read _shift ( 1 ) , color : blob . read _shift ( 1 ) , L : blob . read _shift ( 4 , "i" ) , R : blob . read _shift ( 4 , "i" ) , C : blob . read _shift ( 4 , "i" ) , clsid : blob . read _shift ( 16 ) , state : blob . read _shift ( 4 , "i" ) } ; ctime = blob . read _shift ( 2 ) + blob . read _shift ( 2 ) + blob . read _shift ( 2 ) + blob . read _shift ( 2 ) ; if ( ctime !== 0 ) { o . ctime = ctime ; o . ct = read _date ( blob , blob . l - 8 ) } mtime = blob . read _shift ( 2 ) + blob . read _shift ( 2 ) + blob . read _shift ( 2 ) + blob . read _shift ( 2 ) ; if ( mtime !== 0 ) { o . mtime = mtime ; o . mt = read _date ( blob , blob . l - 8 ) } o . start = blob . read _shift ( 4 , "i" ) ; o . size = blob . read _shift ( 4 , "i" ) ; if ( o . type === 5 ) { minifat _store = o . start ; if ( nmfs > 0 && minifat _store !== ENDOFCHAIN ) sector _list [ minifat _store ] . name = "!StreamData" } else if
var col = data . read _shift ( 4 ) ; var iStyleRef = data . read _shift ( 2 ) ; iStyleRef += data . read _shift ( 1 ) << 16 ; var fPhShow = data . read _shift ( 1 ) ; return { c : col , iStyleRef : iStyleRef } } function write _XLSBCell ( cell , o ) { if ( o == null ) o = new _buf ( 8 ) ; o . write _shift ( - 4 , cell . c ) ; o . write _shift ( 3 , cell . iStyleRef || cell . s ) ; o . write _shift ( 1 , 0 ) ; return o } var parse _XLSBCodeName = parse _XLWideString ; var write _XLSBCodeName = write _XLWideString ; function parse _XLNullableWideString ( data ) { var cchCharacters = data . read _shift ( 4 ) ; return cchCharacters === 0 || cchCharacters === 4294967295 ? "" : data . read _shift ( cchCharacters , "dbcs" ) } function write _XLNullableWideString ( data , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 127 ) } o . write _shift ( 4 , data . length > 0 ? data . length : 4294967295 ) ; if ( data . length > 0 ) o . write _shift ( 0 , data , "dbcs" ) ; return _null ? o . slice ( 0 , o . l ) : o } function parse _XLWideString ( data ) { var cchCharacters = data . read _shift ( 4 ) ; return cchCharacters === 0 ? "" : data . read _shift ( cchCharacters , "dbcs" ) } function write _XLWideString ( data , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 4 + 2 * data . length ) } o . write _shift ( 4 , data . length ) ; if ( data . length > 0 ) o . write _shift ( 0 , data , "dbcs" ) ; return _null ? o . slice ( 0 , o . l ) : o } var parse _XLNameWideString = parse _XLWideString ; var write _XLNameWideString = write _XLWideString ; var parse _RelID = parse _XLNullableWideString ; var write _RelID = write _XLNullableWideString ; function parse _RkNumber ( data ) { var b = data . slice ( data . l , data . l + 4 ) ; var fX100 = b [ 0 ] & 1 , fInt = b [ 0 ] & 2 ; data . l += 4 ; b [ 0 ] &= 252 ; var RK = fInt === 0 ? _ _double ( [ 0 , 0 , 0 , 0 , b [ 0 ] , b [ 1 ] , b [ 2 ] , b [ 3 ] ] , 0 ) : _ _readInt32LE ( b , 0 ) >> 2 ; return fX100 ? RK / 100 : RK } function write _RkNumber ( data , o ) { if ( o == null ) o = new _buf ( 4 ) ; var fX100 = 0 , fInt = 0 , d100 = data * 100 ; if ( data == ( data | 0 ) && data >= - ( 1 << 29 ) && data < 1 << 29 ) { fInt = 1 } else if ( d100 == ( d100 | 0 ) && d100 >= - ( 1 << 29 ) && d100 < 1 << 29 ) { fInt = 1 ; fX100 = 1 } if ( fInt ) o . write _shift ( - 4 , ( ( fX100 ? d100 : data ) << 2 ) + ( fX100 + 2 ) ) ; else throw new Error ( "unsupported RkNumber " + data ) } function parse _RfX ( data ) { var cell = { s : { } , e : { } } ; cell . s . r = data . read _shift ( 4 ) ; cell . e . r = data . read _shift ( 4 ) ; cell . s . c = data . read _shift ( 4 ) ; cell . e . c = data . read _shift ( 4 ) ; return cell } function write _RfX ( r , o ) { if ( ! o ) o = new _buf ( 16 ) ; o . write _shift ( 4 , r . s . r ) ; o . write _shift ( 4 , r . e . r ) ; o . write _shift ( 4 , r . s . c ) ; o . write _shift ( 4 , r . e . c ) ; return o } var parse _UncheckedRfX = parse _RfX ; var write _UncheckedRfX = write _RfX ; function parse _Xnum ( data , length ) { return data . read _shift ( 8 , "f" ) } function write _Xnum ( data , o ) { return ( o || new _buf ( 8 ) ) . write _shift ( 8 , data , "f" ) } var BErr = { 0 : "#NULL!" , 7 : "#DIV/0!" , 15 : "#VALUE!" , 23 : "#REF!" , 29 : "#NAME?" , 36 : "#NUM!" , 42 : "#N/A" , 43 : "#GETTING_DATA" , 255 : "#WTF?" } ; var RBErr = evert _num ( BErr ) ; function parse _BrtColor ( data , length ) { var out = { } ; var d = data . read _shift ( 1 ) ; out . fValidRGB = d & 1 ; out . xColorType = d >>> 1 ; out . index = data . read _shift ( 1 ) ; out . nTintAndShade = data . read _shift ( 2 , "i" ) ; out . bRed = data . read _shift ( 1 ) ; out . bGreen = data . read _shift ( 1 ) ; out . bBlue = data . read _shift ( 1 ) ; out . bAlpha = data . read _shift ( 1 ) } function parse _FontFlags ( data , length ) { var d = data . read _shift ( 1 ) ; data . l ++ ; var out = { fItalic : d & 2 , fStrikeout : d & 8 , fOutline : d & 16 , fShadow : d & 32 , fCondense : d & 64 , fExtend : d & 128 } ; return out } { var VT _EMPTY = 0 ; var VT _NULL = 1 ; var VT _I2 = 2 ; var VT _I4 = 3 ; var VT _R4 = 4 ; var VT _R8 = 5 ; var VT _CY = 6 ; var VT _DATE = 7 ; var VT _BSTR = 8 ; var VT _ERROR = 10 ; var VT _BOOL = 11 ; var VT _VARIANT = 12 ; var VT _DECIMAL = 14 ; var VT _I1 = 16 ; var VT _UI1 = 17 ; var VT _UI2 = 18 ; var VT _UI4 = 19 ; var VT _I8 = 20 ; var VT _UI8 = 21 ; var VT _INT = 22 ; var VT _UINT = 23 ; var VT _LPSTR = 30 ; var VT _LPWSTR = 31 ; var VT _FILETIME = 64 ; var VT _BLOB = 65 ; var VT _STREAM = 66 ; var VT _STORAGE = 67 ; var VT _STREAMED _Object = 68 ; var VT _STORED _Object = 69 ; var VT _BLOB _Object = 70 ; var VT _CF = 71 ; var VT _CLSID = 72 ; var VT _VERSIONED _STREAM = 73 ; var VT _VECTOR = 4096 ; var VT _ARRAY = 8192 ; var VT _STRING = 80 ; var VT _USTR = 81 ; var VT _CUSTOM = [ VT _STRING , VT _USTR ] } var DocSummaryPIDDSI = { 1 : { n : "CodePage" , t : VT _I2 } , 2 : { n : "Category" , t : VT _STRING } , 3 : { n : "PresentationFormat" , t : VT _STRING } , 4 : { n : "ByteCount" , t : VT _I4 } , 5 : { n : "LineCount" , t : VT _I4 } , 6 : { n : "ParagraphCount" , t : VT _I4 } , 7 : { n : "SlideCount" , t : VT _I4 } , 8 : { n : "NoteCount" , t : VT _I4 } , 9 : { n : "HiddenCount" , t : VT _I4 } , 10 : { n : "MultimediaClipCount" , t : VT _I4 } , 11 : { n : "Scale" , t : VT _BOOL } , 12 : { n : "HeadingPair" , t : VT _VECTOR | VT _VARIANT } , 13 : { n : "DocParts" , t : VT _VECTOR | VT _LPSTR } , 14 : { n : "Manager" , t : VT _STRING } , 15 : { n : "Company" , t : VT _
break ; case 30 : blob . l += 4 ; val = parse _VtString ( blob , blob [ blob . l - 4 ] ) ; break ; case 31 : blob . l += 4 ; val = parse _VtString ( blob , blob [ blob . l - 4 ] ) ; break ; case 3 : blob . l += 4 ; val = blob . read _shift ( 4 , "i" ) ; break ; case 19 : blob . l += 4 ; val = blob . read _shift ( 4 ) ; break ; case 5 : blob . l += 4 ; val = blob . read _shift ( 8 , "f" ) ; break ; case 11 : blob . l += 4 ; val = parsebool ( blob , 4 ) ; break ; case 64 : blob . l += 4 ; val = parseDate ( parse _FILETIME ( blob ) ) ; break ; default : throw new Error ( "unparsed value: " + blob [ blob . l ] ) } PropH [ name ] = val } } } blob . l = start _addr + size ; return PropH } function parse _PropertySetStream ( file , PIDSI ) { var blob = file . content ; prep _blob ( blob , 0 ) ; var NumSets , FMTID0 , FMTID1 , Offset0 , Offset1 = 0 ; blob . chk ( "feff" , "Byte Order: " ) ; var vers = blob . read _shift ( 2 ) ; var SystemIdentifier = blob . read _shift ( 4 ) ; blob . chk ( CFB . utils . consts . HEADER _CLSID , "CLSID: " ) ; NumSets = blob . read _shift ( 4 ) ; if ( NumSets !== 1 && NumSets !== 2 ) throw new Error ( "Unrecognized #Sets: " + NumSets ) ; FMTID0 = blob . read _shift ( 16 ) ; Offset0 = blob . read _shift ( 4 ) ; if ( NumSets === 1 && Offset0 !== blob . l ) throw new Error ( "Length mismatch: " + Offset0 + " !== " + blob . l ) ; else if ( NumSets === 2 ) { FMTID1 = blob . read _shift ( 16 ) ; Offset1 = blob . read _shift ( 4 ) } var PSet0 = parse _PropertySet ( blob , PIDSI ) ; var rval = { SystemIdentifier : SystemIdentifier } ; for ( var y in PSet0 ) rval [ y ] = PSet0 [ y ] ; rval . FMTID = FMTID0 ; if ( NumSets === 1 ) return rval ; if ( blob . l !== Offset1 ) throw new Error ( "Length mismatch 2: " + blob . l + " !== " + Offset1 ) ; var PSet1 ; try { PSet1 = parse _PropertySet ( blob , null ) } catch ( e ) { } for ( y in PSet1 ) rval [ y ] = PSet1 [ y ] ; rval . FMTID = [ FMTID0 , FMTID1 ] ; return rval } function parsenoop2 ( blob , length ) { blob . read _shift ( length ) ; return null } function parslurp ( blob , length , cb ) { var arr = [ ] , target = blob . l + length ; while ( blob . l < target ) arr . push ( cb ( blob , target - blob . l ) ) ; if ( target !== blob . l ) throw new Error ( "Slurp error" ) ; return arr } function parsebool ( blob , length ) { return blob . read _shift ( length ) === 1 } function parseuint16 ( blob ) { return blob . read _shift ( 2 , "u" ) } function parseuint16a ( blob , length ) { return parslurp ( blob , length , parseuint16 ) } var parse _Boolean = parsebool ; function parse _Bes ( blob ) { var v = blob . read _shift ( 1 ) , t = blob . read _shift ( 1 ) ; return t === 1 ? v : v === 1 } function parse _ShortXLUnicodeString ( blob , length , opts ) { var cch = blob . read _shift ( opts && opts . biff >= 12 ? 2 : 1 ) ; var width = 1 , encoding = "sbcs-cont" ; var cp = current _codepage ; if ( opts && opts . biff >= 8 ) current _codepage = 1200 ; if ( ! opts || opts . biff == 8 ) { var fHighByte = blob . read _shift ( 1 ) ; if ( fHighByte ) { width = 2 ; encoding = "dbcs-cont" } } else if ( opts . biff == 12 ) { width = 2 ; encoding = "wstr" } var o = cch ? blob . read _shift ( cch , encoding ) : "" ; current _codepage = cp ; return o } function parse _XLUnicodeRichExtendedString ( blob ) { var cp = current _codepage ; current _codepage = 1200 ; var cch = blob . read _shift ( 2 ) , flags = blob . read _shift ( 1 ) ; var fHighByte = flags & 1 , fExtSt = flags & 4 , fRichSt = flags & 8 ; var width = 1 + ( flags & 1 ) ; var cRun = 0 , cbExtRst ; var z = { } ; if ( fRichSt ) cRun = blob . read _shift ( 2 ) ; if ( fExtSt ) cbExtRst = blob . read _shift ( 4 ) ; var encoding = flags & 1 ? "dbcs-cont" : "sbcs-cont" ; var msg = cch === 0 ? "" : blob . read _shift ( cch , encoding ) ; if ( fRichSt ) blob . l += 4 * cRun ; if ( fExtSt ) blob . l += cbExtRst ; z . t = msg ; if ( ! fRichSt ) { z . raw = "<t>" + z . t + "</t>" ; z . r = z . t } current _codepage = cp ; return z } function parse _XLUnicodeStringNoCch ( blob , cch , opts ) { var retval ; if ( opts ) { if ( opts . biff >= 2 && opts . biff <= 5 ) return blob . read _shift ( cch , "sbcs-cont" ) ; if ( opts . biff >= 12 ) return blob . read _shift ( cch , "dbcs-cont" ) } var fHighByte = blob . read _shift ( 1 ) ; if ( fHighByte === 0 ) { retval = blob . read _shift ( cch , "sbcs-cont" ) } else { retval = blob . read _shift ( cch , "dbcs-cont" ) } return retval } function parse _XLUnicodeString ( blob , length , opts ) { var cch = blob . read _shift ( opts && opts . biff == 2 ? 1 : 2 ) ; if ( cch === 0 ) { blob . l ++ ; return "" } return parse _XLUnicodeStringNoCch ( blob , cch , opts ) } function parse _XLUnicodeString2 ( blob , length , opts ) { if ( opts . biff > 5 ) return parse _XLUnicodeString ( blob , length , opts ) ; var cch = blob . read _shift ( 1 ) ; if ( cch === 0 ) { blob . l ++ ; return "" } return blob . read _shift ( cch , "sbcs-cont" ) } var parse _ControlInfo = parsenoop ; var parse _URLMoniker = function ( blob , length ) { var len = blob . read _shift ( 4 ) , start = blob . l ; var extra = false ; if ( len > 24 ) { blob . l += len - 24 ; if ( blob . read _shift ( 16 ) === "795881f43b1d7f48af2c825dc4852763" ) extra = true ; blob . l = start } var url = blob . read _shift ( ( extra ? len - 24 : len ) >> 1 , "utf16le" ) . replace ( chr0 , "" ) ; if ( extra ) blob . l += 24 ; re
out [ 0 ] = [ ] ; for ( C = 0 ; C != fields . length ; ++ C ) out [ 0 ] [ C ] = fields [ C ] . name ; while ( nrow -- > 0 ) { if ( d [ d . l ] === 42 ) { d . l += rlen ; continue } ++ d . l ; out [ ++ R ] = [ ] ; C = 0 ; for ( C = 0 ; C != fields . length ; ++ C ) { var dd = d . slice ( d . l , d . l + fields [ C ] . len ) ; d . l += fields [ C ] . len ; prep _blob ( dd , 0 ) ; var s = cptable . utils . decode ( current _cp , dd ) ; switch ( fields [ C ] . type ) { case "C" : out [ R ] [ C ] = cptable . utils . decode ( current _cp , dd ) ; out [ R ] [ C ] = out [ R ] [ C ] . trim ( ) ; break ; case "D" : if ( s . length === 8 ) out [ R ] [ C ] = new Date ( + s . substr ( 0 , 4 ) , + s . substr ( 4 , 2 ) - 1 , + s . substr ( 6 , 2 ) ) ; else out [ R ] [ C ] = s ; break ; case "F" : out [ R ] [ C ] = parseFloat ( s . trim ( ) ) ; break ; case "I" : out [ R ] [ C ] = dd . read _shift ( 4 , "i" ) ; break ; case "L" : switch ( s . toUpperCase ( ) ) { case "Y" : case "T" : out [ R ] [ C ] = true ; break ; case "N" : case "F" : out [ R ] [ C ] = false ; break ; case " " : case "?" : out [ R ] [ C ] = false ; break ; default : throw new Error ( "DBF Unrecognized L:|" + s + "|" ) } break ; case "M" : if ( ! memo ) throw new Error ( "DBF Unexpected MEMO for type " + ft . toString ( 16 ) ) ; out [ R ] [ C ] = "##MEMO##" + dd . read _shift ( 4 ) ; break ; case "N" : out [ R ] [ C ] = + s . replace ( /\u0000/g , "" ) . trim ( ) ; break ; case "T" : var day = dd . read _shift ( 4 ) , ms = dd . read _shift ( 4 ) ; throw new Error ( day + " | " + ms ) ; case "Y" : out [ R ] [ C ] = dd . read ( 4 , "i" ) / 1e4 ; break ; case "0" : if ( fields [ C ] . name === "_NullFlags" ) break ; default : throw new Error ( "DBF Unsupported data type " + fields [ C ] . type ) } } } if ( ft != 2 ) if ( d . l < d . length && d [ d . l ++ ] != 26 ) throw new Error ( "DBF EOF Marker missing " + ( d . l - 1 ) + " of " + d . length + " " + d [ d . l - 1 ] . toString ( 16 ) ) ; return out } function dbf _to _sheet ( buf , opts ) { var o = opts || { } ; if ( ! o . dateNF ) o . dateNF = "yyyymmdd" ; return aoa _to _sheet ( dbf _to _aoa ( buf , o ) , o ) } function dbf _to _workbook ( buf , opts ) { try { return sheet _to _workbook ( dbf _to _sheet ( buf , opts ) , opts ) } catch ( e ) { if ( opts && opts . WTF ) throw e } return { SheetNames : [ ] , Sheets : { } } } return { to _workbook : dbf _to _workbook , to _sheet : dbf _to _sheet } } ( ) ; var SYLK = function ( ) { function sylk _to _aoa ( d , opts ) { switch ( opts . type ) { case "base64" : return sylk _to _aoa _str ( Base64 . decode ( d ) , opts ) ; case "binary" : return sylk _to _aoa _str ( d , opts ) ; case "buffer" : return sylk _to _aoa _str ( d . toString ( "binary" ) , opts ) ; case "array" : return sylk _to _aoa _str ( cc2str ( d ) , opts ) } throw new Error ( "Unrecognized type " + opts . type ) } function sylk _to _aoa _str ( str , opts ) { var records = str . split ( /[\n\r]+/ ) , R = - 1 , C = - 1 , ri = 0 , rj = 0 , arr = [ ] ; var formats = [ ] ; var next _cell _format = null ; var sht = { } , rowinfo = [ ] , colinfo = [ ] , cw = [ ] ; var Mval = 0 , j ; for ( ; ri !== records . length ; ++ ri ) { Mval = 0 ; var record = records [ ri ] . trim ( ) . split ( ";" ) ; var RT = record [ 0 ] , val ; switch ( RT ) { case "P" : if ( record [ 1 ] . charAt ( 0 ) == "P" ) formats . push ( records [ ri ] . trim ( ) . substr ( 3 ) . replace ( /;;/g , ";" ) ) ; break ; case "C" : case "F" : for ( rj = 1 ; rj < record . length ; ++ rj ) switch ( record [ rj ] . charAt ( 0 ) ) { case "Y" : R = parseInt ( record [ rj ] . substr ( 1 ) ) - 1 ; C = 0 ; for ( j = arr . length ; j <= R ; ++ j ) arr [ j ] = [ ] ; break ; case "X" : C = parseInt ( record [ rj ] . substr ( 1 ) ) - 1 ; break ; case "K" : val = record [ rj ] . substr ( 1 ) ; if ( val . charAt ( 0 ) === '"' ) val = val . substr ( 1 , val . length - 2 ) ; else if ( val === "TRUE" ) val = true ; else if ( val === "FALSE" ) val = false ; else if ( + val === + val ) { val = + val ; if ( next _cell _format !== null && SSF . is _date ( next _cell _format ) ) val = numdate ( val ) } arr [ R ] [ C ] = val ; next _cell _format = null ; break ; case "P" : if ( RT !== "F" ) break ; next _cell _format = formats [ parseInt ( record [ rj ] . substr ( 1 ) ) ] ; break ; case "M" : Mval = parseInt ( record [ rj ] . substr ( 1 ) ) / 20 ; break ; case "W" : if ( RT !== "F" ) break ; cw = record [ rj ] . substr ( 1 ) . split ( " " ) ; for ( j = parseInt ( cw [ 0 ] , 10 ) ; j <= parseInt ( cw [ 1 ] , 10 ) ; ++ j ) { Mval = parseInt ( cw [ 2 ] , 10 ) ; colinfo [ j - 1 ] = Mval == 0 ? { hidden : true } : { wch : Mval } ; process _col ( colinfo [ j - 1 ] ) } break ; case "R" : R = parseInt ( record [ rj ] . substr ( 1 ) ) - 1 ; rowinfo [ R ] = { } ; if ( Mval > 0 ) { rowinfo [ R ] . hpt = Mval ; rowinfo [ R ] . hpx = pt2px ( Mval ) } else if ( Mval == 0 ) rowinfo [ R ] . hidden = true } break ; default : break } } if ( rowinfo . length > 0 ) sht [ "!rows" ] = rowinfo ; if ( colinfo . length > 0 ) sht [ "!cols" ] = colinfo ; arr [ arr . length ] = sht ; return arr } function sylk _to _sheet ( str , opts ) { var aoa = sylk _to _aoa ( str , opts ) ; var ws = aoa . pop ( ) ; var o = aoa _to _sheet ( aoa , opts ) ; keys ( ws ) . forEach ( function ( k ) { o [ k ] = ws [ k ] } ) ; return o } function sylk _to _workbook ( str , opts ) { return sheet _to _workbook ( sylk _to _sheet ( str , opts ) , opts ) } function write _ws _cell _sylk ( cell , ws , R , C , opts ) { var o = "C;Y" + ( R + 1 ) + ";X" + ( C + 1 ) + ";K" ; switch ( cell . t ) { case "n" : o += cell . v || 0 ; if ( cell . f && ! cell . F ) o += ";E" + a1 _to _rc ( cell . f , { r : R , c : C } ) ; break ; case "b" : o += cell . v ? "TRUE" : "FALSE" ; break ; case "e" : o += cell . w || cell . v ;
case 1 : X = C * ( 2 - h6 ) ; rgb [ 0 ] += X ; rgb [ 1 ] += C ; break ; case 2 : X = C * ( h6 - 2 ) ; rgb [ 1 ] += C ; rgb [ 2 ] += X ; break ; case 3 : X = C * ( 4 - h6 ) ; rgb [ 1 ] += X ; rgb [ 2 ] += C ; break ; case 4 : X = C * ( h6 - 4 ) ; rgb [ 2 ] += C ; rgb [ 0 ] += X ; break ; case 5 : X = C * ( 6 - h6 ) ; rgb [ 2 ] += X ; rgb [ 0 ] += C ; break } for ( var i = 0 ; i != 3 ; ++ i ) rgb [ i ] = Math . round ( rgb [ i ] * 255 ) ; return rgb } function rgb _tint ( hex , tint ) { if ( tint === 0 ) return hex ; var hsl = rgb2HSL ( hex2RGB ( hex ) ) ; if ( tint < 0 ) hsl [ 2 ] = hsl [ 2 ] * ( 1 + tint ) ; else hsl [ 2 ] = 1 - ( 1 - hsl [ 2 ] ) * ( 1 - tint ) ; return rgb2Hex ( hsl2RGB ( hsl ) ) } var DEF _MDW = 6 , MAX _MDW = 15 , MIN _MDW = 1 , MDW = DEF _MDW ; function width2px ( width ) { return Math . floor ( ( width + Math . round ( 128 / MDW ) / 256 ) * MDW ) } function px2char ( px ) { return Math . floor ( ( px - 5 ) / MDW * 100 + . 5 ) / 100 } function char2width ( chr ) { return Math . round ( ( chr * MDW + 5 ) / MDW * 256 ) / 256 } function px2char _ ( px ) { return ( ( px - 5 ) / MDW * 100 + . 5 ) / 100 } function char2width _ ( chr ) { return ( chr * MDW + 5 ) / MDW * 256 / 256 } function cycle _width ( collw ) { return char2width ( px2char ( width2px ( collw ) ) ) } function find _mdw _colw ( collw ) { var delta = Infinity , _MDW = MIN _MDW ; for ( MDW = MIN _MDW ; MDW < MAX _MDW ; ++ MDW ) if ( Math . abs ( collw - cycle _width ( collw ) ) <= delta ) { delta = Math . abs ( collw - cycle _width ( collw ) ) ; _MDW = MDW } MDW = _MDW } function find _mdw _wpx ( wpx ) { var delta = Infinity , guess = 0 , _MDW = MIN _MDW ; for ( MDW = MIN _MDW ; MDW < MAX _MDW ; ++ MDW ) { guess = char2width _ ( px2char _ ( wpx ) ) * 256 ; guess = guess % 1 ; if ( guess > . 5 ) guess -- ; if ( Math . abs ( guess ) < delta ) { delta = Math . abs ( guess ) ; _MDW = MDW } } MDW = _MDW } function process _col ( coll ) { if ( coll . width ) { coll . wpx = width2px ( coll . width ) ; coll . wch = px2char ( coll . wpx ) ; coll . MDW = MDW } else if ( coll . wpx ) { coll . wch = px2char ( coll . wpx ) ; coll . width = char2width ( coll . wch ) ; coll . MDW = MDW } else if ( typeof coll . wch == "number" ) { coll . width = char2width ( coll . wch ) ; coll . wpx = width2px ( coll . width ) ; coll . MDW = MDW } if ( coll . customWidth ) delete coll . customWidth } var DEF _PPI = 96 , PPI = DEF _PPI ; function px2pt ( px ) { return px * 96 / PPI } function pt2px ( pt ) { return pt * PPI / 96 } var XLMLPatternTypeMap = { None : "none" , Solid : "solid" , Gray50 : "mediumGray" , Gray75 : "darkGray" , Gray25 : "lightGray" , HorzStripe : "darkHorizontal" , VertStripe : "darkVertical" , ReverseDiagStripe : "darkDown" , DiagStripe : "darkUp" , DiagCross : "darkGrid" , ThickDiagCross : "darkTrellis" , ThinHorzStripe : "lightHorizontal" , ThinVertStripe : "lightVertical" , ThinReverseDiagStripe : "lightDown" , ThinHorzCross : "lightGrid" } ; function parse _borders ( t , styles , themes , opts ) { styles . Borders = [ ] ; var border = { } , sub _border = { } ; t [ 0 ] . match ( tagregex ) . forEach ( function ( x ) { var y = parsexmltag ( x ) ; switch ( y [ 0 ] ) { case "<borders" : case "<borders>" : case "</borders>" : break ; case "<border" : case "<border>" : border = { } ; if ( y . diagonalUp ) { border . diagonalUp = y . diagonalUp } if ( y . diagonalDown ) { border . diagonalDown = y . diagonalDown } styles . Borders . push ( border ) ; break ; case "</border>" : break ; case "<left" : case "<left/>" : break ; case "</left>" : break ; case "<right" : case "<right/>" : break ; case "</right>" : break ; case "<top" : case "<top/>" : break ; case "</top>" : break ; case "<bottom" : case "<bottom/>" : break ; case "</bottom>" : break ; case "<diagonal" : case "<diagonal/>" : break ; case "</diagonal>" : break ; case "<horizontal" : case "<horizontal/>" : break ; case "</horizontal>" : break ; case "<vertical" : case "<vertical/>" : break ; case "</vertical>" : break ; case "<start" : case "<start/>" : break ; case "</start>" : break ; case "<end" : case "<end/>" : break ; case "</end>" : break ; case "<color" : case "<color/>" : break ; case "</color>" : break ; default : if ( opts && opts . WTF ) throw new Error ( "unrecognized " + y [ 0 ] + " in borders" ) } } ) } function parse _fills ( t , styles , themes , opts ) { styles . Fills = [ ] ; var fill = { } ; t [ 0 ] . match ( tagregex ) . forEach ( function ( x ) { var y = parsexmltag ( x ) ; switch ( y [ 0 ] ) { case "<fills" : case "<fills>" : case "</fills>" : break ; case "<fill>" : break ; case "</fill>" : styles . Fills . push ( fill ) ; fill = { } ; break ; case "<gradientFill>" : break ; case "</gradientFill>" : styles . Fills . push ( fill ) ; fill = { } ; break ; case "<patternFill" : case "<patternFill>" : if ( y . patternType ) fill . patternType = y . patternType ; break ; case "<patternFill/>" : case "</patternFill>" : break ; case "<bgColor" : if ( ! fill . bgColor ) fill . bgColor = { } ; if ( y . indexed ) fill . bgColor . indexed = parseInt ( y . indexed , 10 ) ; if ( y . theme ) fill . bgColor . theme = parseInt ( y . theme , 10 ) ; if ( y . tint ) fill . bgColor . tint = parseFloat ( y . tint ) ; if ( y . rgb ) fill . bgColor . rgb = y . rgb . slice ( - 6 ) ; break ; case "<bgColor/>" : case "</bgColor>" : break ; case "<fgColor" : if ( ! fill . fgColor ) fill . fgColor = { } ; if ( y . theme ) fill . f
var parse _BrtCommentText = parse _RichStr ; function parse _comments _bin ( data , opts ) { var out = [ ] ; var authors = [ ] ; var c = { } ; var pass = false ; recordhopper ( data , function hopper _cmnt ( val , R _n , RT ) { switch ( RT ) { case 632 : authors . push ( val ) ; break ; case 635 : c = val ; break ; case 637 : c . t = val . t ; c . h = val . h ; c . r = val . r ; break ; case 636 : c . author = authors [ c . iauthor ] ; delete c . iauthor ; if ( opts . sheetRows && opts . sheetRows <= c . rfx . r ) break ; if ( ! c . t ) c . t = "" ; delete c . rfx ; out . push ( c ) ; break ; case 35 : pass = true ; break ; case 36 : pass = false ; break ; case 37 : break ; case 38 : break ; default : if ( ( R _n || "" ) . indexOf ( "Begin" ) > 0 ) { } else if ( ( R _n || "" ) . indexOf ( "End" ) > 0 ) { } else if ( ! pass || opts . WTF ) throw new Error ( "Unexpected record " + RT + " " + R _n ) } } ) ; return out } function write _comments _bin ( data , opts ) { var ba = buf _array ( ) ; var iauthor = [ ] ; write _record ( ba , "BrtBeginComments" ) ; { write _record ( ba , "BrtBeginCommentAuthors" ) ; data . forEach ( function ( comment ) { comment [ 1 ] . forEach ( function ( c ) { if ( iauthor . indexOf ( c . a ) > - 1 ) return ; iauthor . push ( c . a . substr ( 0 , 54 ) ) ; write _record ( ba , "BrtCommentAuthor" , write _XLWideString ( c . a . substr ( 0 , 54 ) ) ) } ) } ) ; write _record ( ba , "BrtEndCommentAuthors" ) } { write _record ( ba , "BrtBeginCommentList" ) ; data . forEach ( function ( comment ) { comment [ 1 ] . forEach ( function ( c ) { c . iauthor = iauthor . indexOf ( c . a ) ; var range = { s : decode _cell ( comment [ 0 ] ) , e : decode _cell ( comment [ 0 ] ) } ; write _record ( ba , "BrtBeginComment" , write _BrtBeginComment ( [ range , c ] ) ) ; if ( c . t && c . t . length > 0 ) write _record ( ba , "BrtCommentText" , write _RichStr ( c ) ) ; write _record ( ba , "BrtEndComment" ) ; delete c . iauthor } ) } ) ; write _record ( ba , "BrtEndCommentList" ) } write _record ( ba , "BrtEndComments" ) ; return ba . end ( ) } RELS . DS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet" ; RELS . MS = "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet" ; function parse _ds _bin ( ) { return { "!type" : "dialog" } } function parse _ds _xml ( ) { return { "!type" : "dialog" } } function parse _ms _bin ( ) { return { "!type" : "macro" } } function parse _ms _xml ( ) { return { "!type" : "macro" } } var rc _to _a1 = function ( ) { var rcregex = /(^|[^A-Za-z])R(\[?)(-?\d+|)\]?C(\[?)(-?\d+|)\]?/g ; var rcbase = { r : 0 , c : 0 } ; function rcfunc ( $$ , $1 , $2 , $3 , $4 , $5 ) { var R = $3 . length > 0 ? parseInt ( $3 , 10 ) | 0 : 0 , C = $5 . length > 0 ? parseInt ( $5 , 10 ) | 0 : 0 ; if ( C < 0 && $4 . length === 0 ) C = 0 ; var cRel = false , rRel = false ; if ( $4 . length > 0 || $5 . length == 0 ) cRel = true ; if ( cRel ) C += rcbase . c ; else -- C ; if ( $2 . length > 0 || $3 . length == 0 ) rRel = true ; if ( rRel ) R += rcbase . r ; else -- R ; return $1 + ( cRel ? "" : "$" ) + encode _col ( C ) + ( rRel ? "" : "$" ) + encode _row ( R ) } return function rc _to _a1 ( fstr , base ) { rcbase = base ; return fstr . replace ( rcregex , rcfunc ) } } ( ) ; var crefregex = /(^|[^._A-Z0-9])([$]?)([A-Z]{1,2}|[A-W][A-Z]{2}|X[A-E][A-Z]|XF[A-D])([$]?)([1-9]\d{0,5}|10[0-3]\d{4}|104[0-7]\d{3}|1048[0-4]\d{2}|10485[0-6]\d|104857[0-6])(?![_.\(A-Za-z0-9])/g ; var a1 _to _rc = function ( ) { return function a1 _to _rc ( fstr , base ) { return fstr . replace ( crefregex , function ( $0 , $1 , $2 , $3 , $4 , $5 , off , str ) { var c = decode _col ( $3 ) - base . c ; var r = decode _row ( $5 ) - base . r ; return $1 + "R" + ( r == 0 ? "" : "[" + r + "]" ) + "C" + ( c == 0 ? "" : "[" + c + "]" ) } ) } } ( ) ; function shift _formula _str ( f , delta ) { return f . replace ( crefregex , function ( $0 , $1 , $2 , $3 , $4 , $5 , off , str ) { return $1 + ( $2 == "$" ? $2 + $3 : encode _col ( decode _col ( $3 ) + delta . c ) ) + ( $4 == "$" ? $4 + $5 : encode _row ( decode _row ( $5 ) + delta . r ) ) } ) } function shift _formula _xlsx ( f , range , cell ) { var r = decode _range ( range ) , s = r . s , c = decode _cell ( cell ) ; var delta = { r : c . r - s . r , c : c . c - s . c } ; return shift _formula _str ( f , delta ) } function parseread ( l ) { return function ( blob , length ) { blob . l += l ; return } } function parseread1 ( blob , length ) { blob . l += 1 ; return } function parse _ColRelU ( blob , length ) { var c = blob . read _shift ( length == 1 ? 1 : 2 ) ; return [ c & 16383 , c >> 14 & 1 , c >> 15 & 1 ] } function parse _RgceArea ( blob , length , opts ) { var w = 2 ; if ( opts ) { if ( opts . biff >= 2 && opts . biff <= 5 ) return parse _RgceArea _BIFF2 ( blob , length , opts ) ; else if ( opts . biff == 12 ) w = 4 } var r = blob . read _shift ( w ) , R = blob . read _shift ( w ) ; var c = parse _ColRelU ( blob , 2 ) ; var C = parse _ColRelU ( blob , 2 ) ; return { s : { r : r , c : c [ 0 ] , cRel : c [ 1 ] , rRel : c [ 2 ] } , e : { r : R , c : C [ 0 ] , cRel : C [ 1 ] , rRel : C [ 2 ] } } } function parse _RgceArea _BIFF2 ( blob , length , opts ) { var r = parse _ColRelU ( blob , 2 ) , R = parse _ColRelU ( blob , 2 ) ; var c = blob . read _shift ( 1 ) ; var C = blob . read _shift ( 1 ) ; return { s : { r : r [ 0 ] , c : c , cRel : r [ 1 ] , rRel : r [ 2 ] } , e : { r : R [ 0 ] , c : C , cRel : R [ 1 ] , rRel : R [ 2 ] } } } function parse _RgceA
107 : "GET.NAME" , 108 : "SET.VALUE" , 109 : "LOG" , 110 : "EXEC" , 111 : "CHAR" , 112 : "LOWER" , 113 : "UPPER" , 114 : "PROPER" , 115 : "LEFT" , 116 : "RIGHT" , 117 : "EXACT" , 118 : "TRIM" , 119 : "REPLACE" , 120 : "SUBSTITUTE" , 121 : "CODE" , 122 : "NAMES" , 123 : "DIRECTORY" , 124 : "FIND" , 125 : "CELL" , 126 : "ISERR" , 127 : "ISTEXT" , 128 : "ISNUMBER" , 129 : "ISBLANK" , 130 : "T" , 131 : "N" , 132 : "FOPEN" , 133 : "FCLOSE" , 134 : "FSIZE" , 135 : "FREADLN" , 136 : "FREAD" , 137 : "FWRITELN" , 138 : "FWRITE" , 139 : "FPOS" , 140 : "DATEVALUE" , 141 : "TIMEVALUE" , 142 : "SLN" , 143 : "SYD" , 144 : "DDB" , 145 : "GET.DEF" , 146 : "REFTEXT" , 147 : "TEXTREF" , 148 : "INDIRECT" , 149 : "REGISTER" , 150 : "CALL" , 151 : "ADD.BAR" , 152 : "ADD.MENU" , 153 : "ADD.COMMAND" , 154 : "ENABLE.COMMAND" , 155 : "CHECK.COMMAND" , 156 : "RENAME.COMMAND" , 157 : "SHOW.BAR" , 158 : "DELETE.MENU" , 159 : "DELETE.COMMAND" , 160 : "GET.CHART.ITEM" , 161 : "DIALOG.BOX" , 162 : "CLEAN" , 163 : "MDETERM" , 164 : "MINVERSE" , 165 : "MMULT" , 166 : "FILES" , 167 : "IPMT" , 168 : "PPMT" , 169 : "COUNTA" , 170 : "CANCEL.KEY" , 171 : "FOR" , 172 : "WHILE" , 173 : "BREAK" , 174 : "NEXT" , 175 : "INITIATE" , 176 : "REQUEST" , 177 : "POKE" , 178 : "EXECUTE" , 179 : "TERMINATE" , 180 : "RESTART" , 181 : "HELP" , 182 : "GET.BAR" , 183 : "PRODUCT" , 184 : "FACT" , 185 : "GET.CELL" , 186 : "GET.WORKSPACE" , 187 : "GET.WINDOW" , 188 : "GET.DOCUMENT" , 189 : "DPRODUCT" , 190 : "ISNONTEXT" , 191 : "GET.NOTE" , 192 : "NOTE" , 193 : "STDEVP" , 194 : "VARP" , 195 : "DSTDEVP" , 196 : "DVARP" , 197 : "TRUNC" , 198 : "ISLOGICAL" , 199 : "DCOUNTA" , 200 : "DELETE.BAR" , 201 : "UNREGISTER" , 204 : "USDOLLAR" , 205 : "FINDB" , 206 : "SEARCHB" , 207 : "REPLACEB" , 208 : "LEFTB" , 209 : "RIGHTB" , 210 : "MIDB" , 211 : "LENB" , 212 : "ROUNDUP" , 213 : "ROUNDDOWN" , 214 : "ASC" , 215 : "DBCS" , 216 : "RANK" , 219 : "ADDRESS" , 220 : "DAYS360" , 221 : "TODAY" , 222 : "VDB" , 223 : "ELSE" , 224 : "ELSE.IF" , 225 : "END.IF" , 226 : "FOR.CELL" , 227 : "MEDIAN" , 228 : "SUMPRODUCT" , 229 : "SINH" , 230 : "COSH" , 231 : "TANH" , 232 : "ASINH" , 233 : "ACOSH" , 234 : "ATANH" , 235 : "DGET" , 236 : "CREATE.OBJECT" , 237 : "VOLATILE" , 238 : "LAST.ERROR" , 239 : "CUSTOM.UNDO" , 240 : "CUSTOM.REPEAT" , 241 : "FORMULA.CONVERT" , 242 : "GET.LINK.INFO" , 243 : "TEXT.BOX" , 244 : "INFO" , 245 : "GROUP" , 246 : "GET.OBJECT" , 247 : "DB" , 248 : "PAUSE" , 251 : "RESUME" , 252 : "FREQUENCY" , 253 : "ADD.TOOLBAR" , 254 : "DELETE.TOOLBAR" , 255 : "User" , 256 : "RESET.TOOLBAR" , 257 : "EVALUATE" , 258 : "GET.TOOLBAR" , 259 : "GET.TOOL" , 260 : "SPELLING.CHECK" , 261 : "ERROR.TYPE" , 262 : "APP.TITLE" , 263 : "WINDOW.TITLE" , 264 : "SAVE.TOOLBAR" , 265 : "ENABLE.TOOL" , 266 : "PRESS.TOOL" , 267 : "REGISTER.ID" , 268 : "GET.WORKBOOK" , 269 : "AVEDEV" , 270 : "BETADIST" , 271 : "GAMMALN" , 272 : "BETAINV" , 273 : "BINOMDIST" , 274 : "CHIDIST" , 275 : "CHIINV" , 276 : "COMBIN" , 277 : "CONFIDENCE" , 278 : "CRITBINOM" , 279 : "EVEN" , 280 : "EXPONDIST" , 281 : "FDIST" , 282 : "FINV" , 283 : "FISHER" , 284 : "FISHERINV" , 285 : "FLOOR" , 286 : "GAMMADIST" , 287 : "GAMMAINV" , 288 : "CEILING" , 289 : "HYPGEOMDIST" , 290 : "LOGNORMDIST" , 291 : "LOGINV" , 292 : "NEGBINOMDIST" , 293 : "NORMDIST" , 294 : "NORMSDIST" , 295 : "NORMINV" , 296 : "NORMSINV" , 297 : "STANDARDIZE" , 298 : "ODD" , 299 : "PERMUT" , 300 : "POISSON" , 301 : "TDIST" , 302 : "WEIBULL" , 303 : "SUMXMY2" , 304 : "SUMX2MY2" , 305 : "SUMX2PY2" , 306 : "CHITEST" , 307 : "CORREL" , 308 : "COVAR" , 309 : "FORECAST" , 310 : "FTEST" , 311 : "INTERCEPT" , 312 : "PEARSON" , 313 : "RSQ" , 314 : "STEYX" , 315 : "SLOPE" , 316 : "TTEST" , 317 : "PROB" , 318 : "DEVSQ" , 319 : "GEOMEAN" , 320 : "HARMEAN" , 321 : "SUMSQ" , 322 : "KURT" , 323 : "SKEW" , 324 : "ZTEST" , 325 : "LARGE" , 326 : "SMALL" , 327 : "QUARTILE" , 328 : "PERCENTILE" , 329 : "PERCENTRANK" , 330 : "MODE" , 331 : "TRIMMEAN" , 332 : "TINV" , 334 : "MOVIE.COMMAND" , 335 : "GET.MOVIE" , 336 : "CONCATENATE" , 337 : "POWER" , 338 : "PIVOT.ADD.DATA" , 339 : "GET.PIVOT.TABLE" , 340 : "GET.PIVOT.FIELD" , 341 : "GET.PIVOT.ITEM" , 342 : "RADIANS" , 343 : "DEGREES" , 344 : "SUBTOTAL" , 345 : "SUMIF" , 346 : "COUNTIF" , 347 : "COUNTBLANK" , 348 : "SCENARIO.GET" , 349 : "OPTIONS.LISTS.GET" , 350 : "ISPMT" , 351 : "DATEDIF" , 352 : "DATESTRING" , 353 : "NUMBERSTRING" , 354 : "ROMAN" , 355 : "OPEN.DIALOG" , 356 : "SAVE.DIALOG" , 357 : "VIEW.GET" , 358 : "GETPIVOTDATA" , 359 : "HYPERLINK" , 360 : "PHONETIC" , 361 : "AVERAGEA" , 362 : "MAXA" , 363 : "MINA" , 364 : "STDEVPA" , 365 : "VARPA" , 366 : "STDEVA" , 367 : "VARA" , 368 : "BAHTTEXT" , 369 : "THAIDAYOFWEEK" , 370 : "THAIDIGIT" , 371 : "THAIMONTHOFYEAR" , 372 : "THAINUMSOUND" , 373 : "THAINUMSTRING" , 374 : "THAISTRINGLENGTH" , 375 : "ISTHAIDIGIT" , 376 : "ROUNDBAHTDOWN" , 377 : "ROUNDBAHTUP" , 378 : "THAIYEAR" , 379 : "RTD" , 380 : "CUBEVALUE" , 381 : "CUBEMEMBER" , 382 : "CUBEMEMBERPROPERTY" , 383 : "CUBERANKEDMEMBER" , 384 : "HEX2BIN" , 385 : "HEX2DEC" , 386 : "HEX2OCT" , 387 : "DEC2BIN" , 388 : "DEC2HEX" , 389 : "DEC2OCT" , 390 : "OCT2BIN" , 391 : "OCT2HEX" , 392 : "OCT2DEC" , 393 : "BIN2DEC" , 394 : "BIN2OCT" , 395 : "BIN2HEX" ,
if ( opts . cellFormula ) { var formula = parse _XLSBArrayParsedFormula ( data , end - data . l , opts ) ; o [ 1 ] = formula } else data . l = end ; return o } function parse _BrtShrFmla ( data , length , opts ) { var end = data . l + length ; var rfx = parse _UncheckedRfX ( data , 16 ) ; var o = [ rfx ] ; if ( opts . cellFormula ) { var formula = parse _XLSBSharedParsedFormula ( data , end - data . l , opts ) ; o [ 1 ] = formula ; data . l = end } else data . l = end ; return o } function write _BrtColInfo ( C , col , o ) { if ( o == null ) o = new _buf ( 18 ) ; var p = col _obj _w ( C , col ) ; o . write _shift ( - 4 , C ) ; o . write _shift ( - 4 , C ) ; o . write _shift ( 4 , ( p . width || 10 ) * 256 ) ; o . write _shift ( 4 , 0 ) ; var flags = 0 ; if ( col . hidden ) flags |= 1 ; if ( typeof p . width == "number" ) flags |= 2 ; o . write _shift ( 1 , flags ) ; o . write _shift ( 1 , 0 ) ; return o } function parse _BrtMargins ( data , length , opts ) { return { left : parse _Xnum ( data , 8 ) , right : parse _Xnum ( data , 8 ) , top : parse _Xnum ( data , 8 ) , bottom : parse _Xnum ( data , 8 ) , header : parse _Xnum ( data , 8 ) , footer : parse _Xnum ( data , 8 ) } } function write _BrtMargins ( margins , o ) { if ( o == null ) o = new _buf ( 6 * 8 ) ; default _margins ( margins ) ; write _Xnum ( margins . left , o ) ; write _Xnum ( margins . right , o ) ; write _Xnum ( margins . top , o ) ; write _Xnum ( margins . bottom , o ) ; write _Xnum ( margins . header , o ) ; write _Xnum ( margins . footer , o ) ; return o } function write _BrtBeginWsView ( ws , o ) { if ( o == null ) o = new _buf ( 30 ) ; o . write _shift ( 2 , 924 ) ; o . write _shift ( 4 , 0 ) ; o . write _shift ( 4 , 0 ) ; o . write _shift ( 4 , 0 ) ; o . write _shift ( 1 , 0 ) ; o . write _shift ( 1 , 0 ) ; o . write _shift ( 2 , 0 ) ; o . write _shift ( 2 , 100 ) ; o . write _shift ( 2 , 0 ) ; o . write _shift ( 2 , 0 ) ; o . write _shift ( 2 , 0 ) ; o . write _shift ( 4 , 0 ) ; return o } function write _BrtSheetProtection ( sp , o ) { if ( o == null ) o = new _buf ( 16 * 4 + 2 ) ; o . write _shift ( 2 , sp . password ? crypto _CreatePasswordVerifier _Method1 ( sp . password ) : 0 ) ; o . write _shift ( 4 , 1 ) ; [ [ "objects" , false ] , [ "scenarios" , false ] , [ "formatCells" , true ] , [ "formatColumns" , true ] , [ "formatRows" , true ] , [ "insertColumns" , true ] , [ "insertRows" , true ] , [ "insertHyperlinks" , true ] , [ "deleteColumns" , true ] , [ "deleteRows" , true ] , [ "selectLockedCells" , false ] , [ "sort" , true ] , [ "autoFilter" , true ] , [ "pivotTables" , true ] , [ "selectUnlockedCells" , false ] ] . forEach ( function ( n ) { if ( n [ 1 ] ) o . write _shift ( 4 , sp [ n [ 0 ] ] != null && ! sp [ n [ 0 ] ] ? 1 : 0 ) ; else o . write _shift ( 4 , sp [ n [ 0 ] ] != null && sp [ n [ 0 ] ] ? 0 : 1 ) } ) ; return o } function parse _ws _bin ( data , _opts , rels , wb , themes , styles ) { if ( ! data ) return data ; var opts = _opts || { } ; if ( ! rels ) rels = { "!id" : { } } ; if ( DENSE != null && opts . dense == null ) opts . dense = DENSE ; var s = opts . dense ? [ ] : { } ; var ref ; var refguess = { s : { r : 2e6 , c : 2e6 } , e : { r : 0 , c : 0 } } ; var pass = false , end = false ; var row , p , cf , R , C , addr , sstr , rr , cell ; var mergecells = [ ] ; opts . biff = 12 ; opts [ "!row" ] = 0 ; var ai = 0 , af = false ; var array _formulae = [ ] ; var shared _formulae = { } ; var supbooks = [ [ ] ] ; supbooks . sharedf = shared _formulae ; supbooks . arrayf = array _formulae ; supbooks . SheetNames = wb . SheetNames || wb . Sheets . map ( function ( x ) { return x . name } ) ; opts . supbooks = supbooks ; for ( var i = 0 ; i < wb . Names . length ; ++ i ) supbooks [ 0 ] [ i + 1 ] = wb . Names [ i ] ; var colinfo = [ ] , rowinfo = [ ] ; var defwidth = 0 , defheight = 0 ; var seencol = false ; recordhopper ( data , function ws _parse ( val , R _n , RT ) { if ( end ) return ; switch ( RT ) { case 148 : ref = val ; break ; case 0 : row = val ; if ( opts . sheetRows && opts . sheetRows <= row . r ) end = true ; rr = encode _row ( R = row . r ) ; opts [ "!row" ] = row . r ; if ( val . hidden || val . hpt ) { if ( val . hpt ) val . hpx = pt2px ( val . hpt ) ; rowinfo [ val . r ] = val } break ; case 2 : case 3 : case 4 : case 5 : case 6 : case 7 : case 8 : case 9 : case 10 : case 11 : p = { t : val [ 2 ] } ; switch ( val [ 2 ] ) { case "n" : p . v = val [ 1 ] ; break ; case "s" : sstr = strs [ val [ 1 ] ] ; p . v = sstr . t ; p . r = sstr . r ; break ; case "b" : p . v = val [ 1 ] ? true : false ; break ; case "e" : p . v = val [ 1 ] ; if ( opts . cellText !== false ) p . w = BErr [ p . v ] ; break ; case "str" : p . t = "s" ; p . v = utf8read ( val [ 1 ] ) ; break } if ( cf = styles . CellXf [ val [ 0 ] . iStyleRef ] ) safe _format ( p , cf . ifmt , null , opts , themes , styles ) ; C = val [ 0 ] . c ; if ( opts . dense ) { if ( ! s [ R ] ) s [ R ] = [ ] ; s [ R ] [ C ] = p } else s [ encode _col ( C ) + rr ] = p ; if ( opts . cellFormula ) { af = false ; for ( ai = 0 ; ai < array _formulae . length ; ++ ai ) { var aii = array _formulae [ ai ] ; if ( row . r >= aii [ 0 ] . s . r && row . r <= aii [ 0 ] . e . r ) if ( C >= aii [ 0 ] . s . c && C <= aii [ 0 ] . e . c ) { p . F = encode _range ( aii [ 0 ] ) ; af = true } } if ( ! af && val . length > 3 ) p . f = val [ 3 ] } if ( refguess . s . r > row . r ) refguess . s . r = row . r ; if ( refguess . s . c > C ) refguess . s . c = C ; if ( refguess . e . r < row . r ) refguess . e . r = row . r ; if ( refguess . e . c < C ) refguess . e . c = C ; if ( opts . cellDates && cf && p . t == "n" && SSF . is _date ( SSF . _table [ cf . ifmt ] ) ) { var _d = SSF . parse _date _code ( p . v ) ; if ( _d ) { p . t = "d" ; p . v = new Date ( Date
Target : cell . HRef , Tooltip : cell . HRefScreenTip } ; delete cell . HRef ; delete cell . HRefScreenTip } if ( cell . MergeAcross || cell . MergeDown ) { var cc = c + ( parseInt ( cell . MergeAcross , 10 ) | 0 ) ; var rr = r + ( parseInt ( cell . MergeDown , 10 ) | 0 ) ; mergecells . push ( { s : { c : c , r : r } , e : { c : cc , r : rr } } ) } if ( ! opts . sheetStubs ) { if ( cell . MergeAcross ) c = cc + 1 ; else ++ c } else if ( cell . MergeAcross || cell . MergeDown ) { for ( var cma = c ; cma <= cc ; ++ cma ) { for ( var cmd = r ; cmd <= rr ; ++ cmd ) { if ( cma > c || cmd > r ) { if ( opts . dense ) { if ( ! cursheet [ cmd ] ) cursheet [ cmd ] = [ ] ; cursheet [ cmd ] [ cma ] = { t : "z" } } else cursheet [ encode _col ( cma ) + encode _row ( cmd ) ] = { t : "z" } } } } c = cc + 1 } else ++ c } else { cell = xlml _parsexmltagobj ( Rn [ 0 ] ) ; if ( cell . Index ) c = + cell . Index - 1 ; if ( c < refguess . s . c ) refguess . s . c = c ; if ( c > refguess . e . c ) refguess . e . c = c ; if ( Rn [ 0 ] . slice ( - 2 ) === "/>" ) ++ c ; comments = [ ] } break ; case "Row" : if ( Rn [ 1 ] === "/" || Rn [ 0 ] . slice ( - 2 ) === "/>" ) { if ( r < refguess . s . r ) refguess . s . r = r ; if ( r > refguess . e . r ) refguess . e . r = r ; if ( Rn [ 0 ] . slice ( - 2 ) === "/>" ) { row = xlml _parsexmltag ( Rn [ 0 ] ) ; if ( row . Index ) r = + row . Index - 1 } c = 0 ; ++ r } else { row = xlml _parsexmltag ( Rn [ 0 ] ) ; if ( row . Index ) r = + row . Index - 1 ; rowobj = { } ; if ( row . AutoFitHeight == "0" ) { rowobj . hpx = parseInt ( row . Height , 10 ) ; rowobj . hpt = px2pt ( rowobj . hpx ) ; rowinfo [ r ] = rowobj } if ( row . Hidden == "1" ) { rowobj . hidden = true ; rowinfo [ r ] = rowobj } } break ; case "Worksheet" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw new Error ( "Bad state: " + tmp . join ( "|" ) ) ; sheetnames . push ( sheetname ) ; if ( refguess . s . r <= refguess . e . r && refguess . s . c <= refguess . e . c ) cursheet [ "!ref" ] = encode _range ( refguess ) ; if ( mergecells . length ) cursheet [ "!merges" ] = mergecells ; if ( cstys . length > 0 ) cursheet [ "!cols" ] = cstys ; if ( rowinfo . length > 0 ) cursheet [ "!rows" ] = rowinfo ; sheets [ sheetname ] = cursheet } else { refguess = { s : { r : 2e6 , c : 2e6 } , e : { r : 0 , c : 0 } } ; r = c = 0 ; state . push ( [ Rn [ 3 ] , false ] ) ; tmp = xlml _parsexmltag ( Rn [ 0 ] ) ; sheetname = unescapexml ( tmp . Name ) ; cursheet = opts . dense ? [ ] : { } ; mergecells = [ ] ; arrayf = [ ] ; rowinfo = [ ] ; wsprops = { name : sheetname , Hidden : 0 } ; Workbook . Sheets . push ( wsprops ) } break ; case "Table" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw new Error ( "Bad state: " + tmp . join ( "|" ) ) } else if ( Rn [ 0 ] . slice ( - 2 ) == "/>" ) break ; else { table = xlml _parsexmltag ( Rn [ 0 ] ) ; state . push ( [ Rn [ 3 ] , false ] ) ; cstys = [ ] ; seencol = false } break ; case "Style" : if ( Rn [ 1 ] === "/" ) process _style _xlml ( styles , stag , opts ) ; else stag = xlml _parsexmltag ( Rn [ 0 ] ) ; break ; case "NumberFormat" : stag . nf = unescapexml ( xlml _parsexmltag ( Rn [ 0 ] ) . Format || "General" ) ; if ( XLMLFormatMap [ stag . nf ] ) stag . nf = XLMLFormatMap [ stag . nf ] ; for ( var ssfidx = 0 ; ssfidx != 392 ; ++ ssfidx ) if ( SSF . _table [ ssfidx ] == stag . nf ) break ; if ( ssfidx == 392 ) for ( ssfidx = 57 ; ssfidx != 392 ; ++ ssfidx ) if ( SSF . _table [ ssfidx ] == null ) { SSF . load ( stag . nf , ssfidx ) ; break } break ; case "Column" : if ( state [ state . length - 1 ] [ 0 ] !== "Table" ) break ; csty = xlml _parsexmltag ( Rn [ 0 ] ) ; if ( csty . Hidden ) { csty . hidden = true ; delete csty . Hidden } if ( csty . Width ) csty . wpx = parseInt ( csty . Width , 10 ) ; if ( ! seencol && csty . wpx > 10 ) { seencol = true ; MDW = DEF _MDW ; for ( var _col = 0 ; _col < cstys . length ; ++ _col ) if ( cstys [ _col ] ) process _col ( cstys [ _col ] ) } if ( seencol ) process _col ( csty ) ; cstys [ csty . Index - 1 || cstys . length ] = csty ; for ( var i = 0 ; i < + csty . Span ; ++ i ) cstys [ cstys . length ] = dup ( csty ) ; break ; case "NamedRange" : if ( ! Workbook . Names ) Workbook . Names = [ ] ; var _NamedRange = parsexmltag ( Rn [ 0 ] ) ; var _DefinedName = { Name : _NamedRange . Name , Ref : rc _to _a1 ( _NamedRange . RefersTo . substr ( 1 ) ) } ; if ( Workbook . Sheets . length > 0 ) _DefinedName . Sheet = Workbook . Sheets . length - 1 ; Workbook . Names . push ( _DefinedName ) ; break ; case "NamedCell" : break ; case "B" : break ; case "I" : break ; case "U" : break ; case "S" : break ; case "Sub" : break ; case "Sup" : break ; case "Span" : break ; case "Border" : break ; case "Alignment" : break ; case "Borders" : break ; case "Font" : if ( Rn [ 0 ] . slice ( - 2 ) === "/>" ) break ; else if ( Rn [ 1 ] === "/" ) ss += str . slice ( fidx , Rn . index ) ; else fidx = Rn . index + Rn [ 0 ] . length ; break ; case "Interior" : if ( ! opts . cellStyles ) break ; stag . Interior = xlml _parsexmltag ( Rn [ 0 ] ) ; break ; case "Protection" : break ; case "Author" : case "Title" : case "Description" : case "Created" : case "Keywords" : case "Subject" : case "Category" : case "Company" : case "LastAuthor" : case "LastSaved" : case "LastPrinted" : case "Version" : case "Revision" : case "TotalTime" : case "HyperlinkBase" : case "Manager" : case "ContentStatus" : case "Identifier" : case "Language" : if ( Rn [ 0 ] . slice ( - 2 ) === "/>" ) break ; else if ( Rn [ 1 ] === "/" ) xlml _set _prop ( Props , Rn [ 3 ] , str . slice ( pidx , Rn
temp _val = make _cell ( val . val , val . ixfe , "s" ) ; temp _val . XF = XFs [ temp _val . ixfe ] ; safe _format _xf ( temp _val , options , wb . opts . Date1904 ) ; addcell ( { c : val . c , r : val . r } , temp _val , options ) ; break ; case "Dimensions" : { if ( file _depth === 1 ) range = val } break ; case "SST" : { sst = val } break ; case "Format" : { SSF . load ( val [ 1 ] , val [ 0 ] ) } break ; case "BIFF2FORMAT" : { SSF . load ( val , BIFF2Fmt ++ ) } break ; case "MergeCells" : mergecells = mergecells . concat ( val ) ; break ; case "Obj" : objects [ val . cmo [ 0 ] ] = opts . lastobj = val ; break ; case "TxO" : opts . lastobj . TxO = val ; break ; case "HLink" : { for ( rngR = val [ 0 ] . s . r ; rngR <= val [ 0 ] . e . r ; ++ rngR ) for ( rngC = val [ 0 ] . s . c ; rngC <= val [ 0 ] . e . c ; ++ rngC ) { cc = options . dense ? ( out [ rngR ] || [ ] ) [ rngC ] : out [ encode _cell ( { c : rngC , r : rngR } ) ] ; if ( cc ) cc . l = val [ 1 ] } } break ; case "HLinkTooltip" : { for ( rngR = val [ 0 ] . s . r ; rngR <= val [ 0 ] . e . r ; ++ rngR ) for ( rngC = val [ 0 ] . s . c ; rngC <= val [ 0 ] . e . c ; ++ rngC ) { cc = options . dense ? ( out [ rngR ] || [ ] ) [ rngC ] : out [ encode _cell ( { c : rngC , r : rngR } ) ] ; if ( cc ) cc . l . Tooltip = val [ 1 ] } } break ; case "Note" : { if ( opts . biff <= 5 && opts . biff >= 2 ) break ; cc = options . dense ? ( out [ val [ 0 ] . r ] || [ ] ) [ val [ 0 ] . c ] : out [ encode _cell ( val [ 0 ] ) ] ; var noteobj = objects [ val [ 2 ] ] ; if ( ! cc ) break ; if ( ! cc . c ) cc . c = [ ] ; cmnt = { a : val [ 1 ] , t : noteobj . TxO . t } ; cc . c . push ( cmnt ) } break ; default : switch ( R . n ) { case "ClrtClient" : break ; case "XFExt" : update _xfext ( XFs [ val . ixfe ] , val . ext ) ; break ; case "DefColWidth" : defwidth = val ; break ; case "DefaultRowHeight" : defheight = val [ 1 ] ; break ; case "ColInfo" : { if ( ! opts . cellStyles ) break ; while ( val . e >= val . s ) { colinfo [ val . e -- ] = { width : val . w / 256 } ; if ( ! seencol ) { seencol = true ; find _mdw _colw ( val . w / 256 ) } process _col ( colinfo [ val . e + 1 ] ) } } break ; case "Row" : { var rowobj = { } ; if ( val . hidden ) { rowinfo [ val . r ] = rowobj ; rowobj . hidden = true } if ( val . hpt ) { rowinfo [ val . r ] = rowobj ; rowobj . hpt = val . hpt ; rowobj . hpx = pt2px ( val . hpt ) } } break ; case "LeftMargin" : case "RightMargin" : case "TopMargin" : case "BottomMargin" : if ( ! out [ "!margins" ] ) default _margins ( out [ "!margins" ] = { } ) ; switch ( Rn ) { case "LeftMargin" : out [ "!margins" ] . left = val ; break ; case "RightMargin" : out [ "!margins" ] . right = val ; break ; case "TopMargin" : out [ "!margins" ] . top = val ; break ; case "BottomMargin" : out [ "!margins" ] . bottom = val ; break } break ; case "Setup" : if ( ! out [ "!margins" ] ) default _margins ( out [ "!margins" ] = { } ) ; out [ "!margins" ] . header = val . header ; out [ "!margins" ] . footer = val . footer ; break ; case "Header" : break ; case "Footer" : break ; case "HCenter" : break ; case "VCenter" : break ; case "Pls" : break ; case "GCW" : break ; case "LHRecord" : break ; case "DBCell" : break ; case "EntExU2" : break ; case "SxView" : break ; case "Sxvd" : break ; case "SXVI" : break ; case "SXVDEx" : break ; case "SxIvd" : break ; case "SXDI" : break ; case "SXLI" : break ; case "SXEx" : break ; case "QsiSXTag" : break ; case "Selection" : break ; case "Feat" : break ; case "FeatHdr" : case "FeatHdr11" : break ; case "Feature11" : case "Feature12" : case "List12" : break ; case "Country" : country = val ; break ; case "RecalcId" : break ; case "DxGCol" : break ; case "Fbi" : case "Fbi2" : case "GelFrame" : break ; case "Font" : break ; case "XFCRC" : break ; case "Style" : break ; case "StyleExt" : break ; case "Palette" : palette = val ; break ; case "Theme" : break ; case "ScenarioProtect" : break ; case "ObjProtect" : break ; case "CondFmt12" : break ; case "Table" : break ; case "TableStyles" : break ; case "TableStyle" : break ; case "TableStyleElement" : break ; case "SXStreamID" : break ; case "SXVS" : break ; case "DConRef" : break ; case "SXAddl" : break ; case "DConBin" : break ; case "DConName" : break ; case "SXPI" : break ; case "SxFormat" : break ; case "SxSelect" : break ; case "SxRule" : break ; case "SxFilt" : break ; case "SxItm" : break ; case "SxDXF" : break ; case "ScenMan" : break ; case "DCon" : break ; case "CellWatch" : break ; case "PrintRowCol" : break ; case "PrintGrid" : break ; case "PrintSize" : break ; case "XCT" : break ; case "CRN" : break ; case "Scl" : { } break ; case "SheetExt" : { } break ; case "SheetExtOptional" : { } break ; case "ObNoMacros" : { } break ; case "ObProj" : { } break ; case "CodeName" : { } break ; case "GUIDTypeLib" : { } break ; case "WOpt" : break ; case "PhoneticInfo" : break ; case "OleObjectSize" : break ; case "DXF" : case "DXFN" : case "DXFN12" : case "DXFN12List" : case "DXFN12NoCB" : break ; case "Dv" : case "DVal" : break ; case "BRAI" : case "Series" : case "SeriesText" : break ; case "DConn" : break ; case "DbOrParamQry" : break ; case "DBQueryExt" : break ; case "IFmtRecord" : break ; case "CondFmt" : case "CF" : case "CF12" : case "CFEx" : break ; case "Excel9File" : break ; case "Units" : break ; case "InterfaceHdr" : case "Mms" : case "InterfaceEnd" : case "DSF" : case "BuiltInFnGroupCount" : case "Window1" : case " Wind
} , 1047 : { n : "BrtEndConditionalFormatting14" , f : parsenoop } , 1048 : { n : "BrtBeginCFRule14" , f : parsenoop } , 1049 : { n : "BrtEndCFRule14" , f : parsenoop } , 1050 : { n : "BrtCFVO14" , f : parsenoop } , 1051 : { n : "BrtBeginDatabar14" , f : parsenoop } , 1052 : { n : "BrtBeginIconSet14" , f : parsenoop } , 1053 : { n : "BrtDVal14" , f : parsenoop } , 1054 : { n : "BrtBeginDVals14" , f : parsenoop } , 1055 : { n : "BrtColor14" , f : parsenoop } , 1056 : { n : "BrtBeginSparklines" , f : parsenoop } , 1057 : { n : "BrtEndSparklines" , f : parsenoop } , 1058 : { n : "BrtBeginSparklineGroups" , f : parsenoop } , 1059 : { n : "BrtEndSparklineGroups" , f : parsenoop } , 1061 : { n : "BrtSXVD14" , f : parsenoop } , 1062 : { n : "BrtBeginSxview14" , f : parsenoop } , 1063 : { n : "BrtEndSxview14" , f : parsenoop } , 1066 : { n : "BrtBeginPCD14" , f : parsenoop } , 1067 : { n : "BrtEndPCD14" , f : parsenoop } , 1068 : { n : "BrtBeginExtConn14" , f : parsenoop } , 1069 : { n : "BrtEndExtConn14" , f : parsenoop } , 1070 : { n : "BrtBeginSlicerCacheIDs" , f : parsenoop } , 1071 : { n : "BrtEndSlicerCacheIDs" , f : parsenoop } , 1072 : { n : "BrtBeginSlicerCacheID" , f : parsenoop } , 1073 : { n : "BrtEndSlicerCacheID" , f : parsenoop } , 1075 : { n : "BrtBeginSlicerCache" , f : parsenoop } , 1076 : { n : "BrtEndSlicerCache" , f : parsenoop } , 1077 : { n : "BrtBeginSlicerCacheDef" , f : parsenoop } , 1078 : { n : "BrtEndSlicerCacheDef" , f : parsenoop } , 1079 : { n : "BrtBeginSlicersEx" , f : parsenoop } , 1080 : { n : "BrtEndSlicersEx" , f : parsenoop } , 1081 : { n : "BrtBeginSlicerEx" , f : parsenoop } , 1082 : { n : "BrtEndSlicerEx" , f : parsenoop } , 1083 : { n : "BrtBeginSlicer" , f : parsenoop } , 1084 : { n : "BrtEndSlicer" , f : parsenoop } , 1085 : { n : "BrtSlicerCachePivotTables" , f : parsenoop } , 1086 : { n : "BrtBeginSlicerCacheOlapImpl" , f : parsenoop } , 1087 : { n : "BrtEndSlicerCacheOlapImpl" , f : parsenoop } , 1088 : { n : "BrtBeginSlicerCacheLevelsData" , f : parsenoop } , 1089 : { n : "BrtEndSlicerCacheLevelsData" , f : parsenoop } , 1090 : { n : "BrtBeginSlicerCacheLevelData" , f : parsenoop } , 1091 : { n : "BrtEndSlicerCacheLevelData" , f : parsenoop } , 1092 : { n : "BrtBeginSlicerCacheSiRanges" , f : parsenoop } , 1093 : { n : "BrtEndSlicerCacheSiRanges" , f : parsenoop } , 1094 : { n : "BrtBeginSlicerCacheSiRange" , f : parsenoop } , 1095 : { n : "BrtEndSlicerCacheSiRange" , f : parsenoop } , 1096 : { n : "BrtSlicerCacheOlapItem" , f : parsenoop } , 1097 : { n : "BrtBeginSlicerCacheSelections" , f : parsenoop } , 1098 : { n : "BrtSlicerCacheSelection" , f : parsenoop } , 1099 : { n : "BrtEndSlicerCacheSelections" , f : parsenoop } , 1100 : { n : "BrtBeginSlicerCacheNative" , f : parsenoop } , 1101 : { n : "BrtEndSlicerCacheNative" , f : parsenoop } , 1102 : { n : "BrtSlicerCacheNativeItem" , f : parsenoop } , 1103 : { n : "BrtRangeProtection14" , f : parsenoop } , 1104 : { n : "BrtRangeProtectionIso14" , f : parsenoop } , 1105 : { n : "BrtCellIgnoreEC14" , f : parsenoop } , 1111 : { n : "BrtList14" , f : parsenoop } , 1112 : { n : "BrtCFIcon" , f : parsenoop } , 1113 : { n : "BrtBeginSlicerCachesPivotCacheIDs" , f : parsenoop } , 1114 : { n : "BrtEndSlicerCachesPivotCacheIDs" , f : parsenoop } , 1115 : { n : "BrtBeginSlicers" , f : parsenoop } , 1116 : { n : "BrtEndSlicers" , f : parsenoop } , 1117 : { n : "BrtWbProp14" , f : parsenoop } , 1118 : { n : "BrtBeginSXEdit" , f : parsenoop } , 1119 : { n : "BrtEndSXEdit" , f : parsenoop } , 1120 : { n : "BrtBeginSXEdits" , f : parsenoop } , 1121 : { n : "BrtEndSXEdits" , f : parsenoop } , 1122 : { n : "BrtBeginSXChange" , f : parsenoop } , 1123 : { n : "BrtEndSXChange" , f : parsenoop } , 1124 : { n : "BrtBeginSXChanges" , f : parsenoop } , 1125 : { n : "BrtEndSXChanges" , f : parsenoop } , 1126 : { n : "BrtSXTupleItems" , f : parsenoop } , 1128 : { n : "BrtBeginSlicerStyle" , f : parsenoop } , 1129 : { n : "BrtEndSlicerStyle" , f : parsenoop } , 1130 : { n : "BrtSlicerStyleElement" , f : parsenoop } , 1131 : { n : "BrtBeginStyleSheetExt14" , f : parsenoop } , 1132 : { n : "BrtEndStyleSheetExt14" , f : parsenoop } , 1133 : { n : "BrtBeginSlicerCachesPivotCacheID" , f : parsenoop } , 1134 : { n : "BrtEndSlicerCachesPivotCacheID" , f : parsenoop } , 1135 : { n : "BrtBeginConditionalFormattings" , f : parsenoop } , 1136 : { n : "BrtEndConditionalFormattings" , f : parsenoop } , 1137 : { n : "BrtBeginPCDCalcMemExt" , f : parsenoop } , 1138 : { n : "BrtEndPCDCalcMemExt" , f : parsenoop } , 1139 : { n : "BrtBeginPCDCalcMemsExt" , f : parsenoop } , 1140 : { n : "BrtEndPCDCalcMemsExt" , f : parsenoop } , 1141 : { n : "BrtPCDField14" , f : parsenoop } , 1142 : { n : "BrtBeginSlicerStyles" , f : parsenoop } , 1143 : { n : "BrtEndSlicerStyles" , f : parsenoop } , 1144 : { n : "BrtBeginSlicerStyleElements" , f : parsenoop } , 1145 : { n : "BrtEndSlicerStyleElements" , f : parsenoop } , 1146 : { n : "BrtCFRuleExt" , f : parsenoop } , 1147 : { n : "BrtBeginSXCondFmt14" , f : parsenoop } , 1148 : { n : "BrtEndSXCondFmt14" , f : parsenoop } , 1149 : { n : "BrtBeginSXCondFmts14" , f : parsenoop } , 1150 : { n : "BrtEndSXCondFmts14" , f : parsenoop } , 1152 : { n : " BrtBe
} if ( ctag [ "number-columns-spanned" ] || ctag [ "number-rows-spanned" ] ) { mR = parseInt ( ctag [ "number-rows-spanned" ] , 10 ) || 0 ; mC = parseInt ( ctag [ "number-columns-spanned" ] , 10 ) || 0 ; mrange = { s : { r : R , c : C } , e : { r : R + mR - 1 , c : C + mC - 1 } } ; merges . push ( mrange ) } if ( ctag [ "number-columns-repeated" ] ) rept = parseInt ( ctag [ "number-columns-repeated" ] , 10 ) ; switch ( q . t ) { case "boolean" : q . t = "b" ; q . v = parsexmlbool ( ctag [ "boolean-value" ] ) ; break ; case "float" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "percentage" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "currency" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "date" : q . t = "d" ; q . v = parseDate ( ctag [ "date-value" ] ) ; if ( ! opts . cellDates ) { q . t = "n" ; q . v = datenum ( q . v ) } q . z = "m/d/yy" ; break ; case "time" : q . t = "n" ; q . v = parse _isodur ( ctag [ "time-value" ] ) / 86400 ; break ; case "number" : q . t = "n" ; q . v = parseFloat ( ctag [ "数据数值" ] ) ; break ; default : if ( q . t === "string" || q . t === "text" || ! q . t ) { q . t = "s" ; if ( ctag [ "string-value" ] != null ) textp = unescapexml ( ctag [ "string-value" ] ) } else throw new Error ( "Unsupported value type " + q . t ) } } else { isstub = false ; if ( q . t === "s" ) { q . v = textp || "" ; isstub = textpidx == 0 } if ( comments . length > 0 ) { q . c = comments ; comments = [ ] } if ( textp && opts . cellText !== false ) q . w = textp ; if ( ! isstub || opts . sheetStubs ) { if ( ! ( opts . sheetRows && opts . sheetRows < R ) ) { if ( opts . dense ) { if ( ! ws [ R ] ) ws [ R ] = [ ] ; ws [ R ] [ C ] = q ; while ( -- rept > 0 ) ws [ R ] [ ++ C ] = dup ( q ) } else { ws [ encode _cell ( { r : R , c : C } ) ] = q ; while ( -- rept > 0 ) ws [ encode _cell ( { r : R , c : ++ C } ) ] = dup ( q ) } if ( range . e . c <= C ) range . e . c = C } } else { C += rept ; rept = 0 } q = { } ; textp = "" } break ; case "document" : case "document-content" : case "电子表格文档" : case "spreadsheet" : case "主体" : case "scripts" : case "styles" : case "font-face-decls" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) state . push ( [ Rn [ 3 ] , true ] ) ; break ; case "annotation" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp ; comment . t = textp ; comment . a = creator ; comments . push ( comment ) } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) { state . push ( [ Rn [ 3 ] , false ] ) } creator = "" ; creatoridx = 0 ; textp = "" ; textpidx = 0 ; break ; case "creator" : if ( Rn [ 1 ] === "/" ) { creator = str . slice ( creatoridx , Rn . index ) } else creatoridx = Rn . index + Rn [ 0 ] . length ; break ; case "meta" : case "元数据" : case "settings" : case "config-item-set" : case "config-item-map-indexed" : case "config-item-map-entry" : case "config-item-map-named" : case "shapes" : case "frame" : case "text-box" : case "image" : case "data-pilot-tables" : case "list-style" : case "form" : case "dde-links" : case "event-listeners" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) state . push ( [ Rn [ 3 ] , false ] ) ; textp = "" ; textpidx = 0 ; break ; case "scientific-number" : break ; case "currency-symbol" : break ; case "currency-style" : break ; case "number-style" : case "percentage-style" : case "date-style" : case "time-style" : if ( Rn [ 1 ] === "/" ) { number _format _map [ NFtag . name ] = NF ; if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) { NF = "" ; NFtag = parsexmltag ( Rn [ 0 ] , false ) ; state . push ( [ Rn [ 3 ] , true ] ) } break ; case "script" : break ; case "libraries" : break ; case "automatic-styles" : break ; case "master-styles" : break ; case "default-style" : case "page-layout" : break ; case "style" : break ; case "map" : break ; case "font-face" : break ; case "paragraph-properties" : break ; case "table-properties" : break ; case "table-column-properties" : break ; case "table-row-properties" : break ; case "table-cell-properties" : break ; case "number" : switch ( state [ state . length - 1 ] [ 0 ] ) { case "time-style" : case "date-style" : tag = parsexmltag ( Rn [ 0 ] , false ) ; NF += number _formats [ Rn [ 3 ] ] [ tag . style === "long" ? 1 : 0 ] ; break } break ; case "fraction" : break ; case "day" : case "month" : case "year" : case "era" : case "day-of-week" : case "week-of-year" : case "quarter" : case "hours" : case "minutes" : case "seconds" : case "am-pm" : switch ( state [ state . length - 1 ] [ 0 ] ) { case "time-style" : case "date-style" : tag = parsexmltag ( Rn [ 0 ] , false ) ; NF += number _formats [ Rn [ 3 ] ] [ tag . style === "long" ? 1 : 0 ] ; break } break ; case "boolean-style" : break ; case "boolean" : break ; case "text-style" : break ; case "text" : if ( Rn [ 0 ] . slice ( - 2 ) === "/>" ) break ; else if ( Rn [ 1 ] === "/" ) switch ( state [ state . length - 1 ] [ 0 ] ) { case "number-style" : case "date-style" : case "time-style" : NF += str . slice ( pidx , Rn . index ) ; break } else pidx = Rn . index + Rn [ 0 ] . length ; break ; case " te
} if ( o . blankrows === false && isempty ) return null ; return row } function sheet _to _csv ( sheet , opts ) { var out = [ ] ; var o = opts == null ? { } : opts ; if ( sheet == null || sheet [ "!ref" ] == null ) return "" ; var r = safe _decode _range ( sheet [ "!ref" ] ) ; var FS = o . FS !== undefined ? o . FS : "," , fs = FS . charCodeAt ( 0 ) ; var RS = o . RS !== undefined ? o . RS : "\n" , rs = RS . charCodeAt ( 0 ) ; var endregex = new RegExp ( ( FS == "|" ? "\\|" : FS ) + "+$" ) ; var row = "" , cols = [ ] ; o . dense = Array . isArray ( sheet ) ; for ( var C = r . s . c ; C <= r . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; for ( var R = r . s . r ; R <= r . e . r ; ++ R ) { row = make _csv _row ( sheet , r , R , cols , fs , rs , FS , o ) ; if ( row == null ) { continue } if ( o . strip ) row = row . replace ( endregex , "" ) ; out . push ( row + RS ) } delete o . dense ; return out . join ( "" ) } function sheet _to _txt ( sheet , opts ) { if ( ! opts ) opts = { } ; opts . FS = "\t" ; opts . RS = "\n" ; var s = sheet _to _csv ( sheet , opts ) ; if ( typeof cptable == "undefined" ) return s ; var o = cptable . utils . encode ( 1200 , s ) ; return "ÿþ" + o } function sheet _to _formulae ( sheet ) { var y = "" , x , val = "" ; if ( sheet == null || sheet [ "!ref" ] == null ) return [ ] ; var r = safe _decode _range ( sheet [ "!ref" ] ) , rr = "" , cols = [ ] , C ; var cmds = new Array ( ( r . e . r - r . s . r + 1 ) * ( r . e . c - r . s . c + 1 ) ) ; var i = 0 ; var dense = Array . isArray ( sheet ) ; for ( C = r . s . c ; C <= r . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; for ( var R = r . s . r ; R <= r . e . r ; ++ R ) { rr = encode _row ( R ) ; for ( C = r . s . c ; C <= r . e . c ; ++ C ) { y = cols [ C ] + rr ; x = dense ? ( sheet [ R ] || [ ] ) [ C ] : sheet [ y ] ; val = "" ; if ( x === undefined ) continue ; else if ( x . F != null ) { y = x . F ; if ( ! x . f ) continue ; val = x . f ; if ( y . indexOf ( ":" ) == - 1 ) y = y + ":" + y } if ( x . f != null ) val = x . f ; else if ( x . t == "z" ) continue ; else if ( x . t == "n" && x . v != null ) val = "" + x . v ; else if ( x . t == "b" ) val = x . v ? "TRUE" : "FALSE" ; else if ( x . w !== undefined ) val = "'" + x . w ; else if ( x . v === undefined ) continue ; else if ( x . t == "s" ) val = "'" + x . v ; else val = "" + x . v ; cmds [ i ++ ] = y + "=" + val } } cmds . length = i ; return cmds } var utils = { encode _col : encode _col , encode _row : encode _row , encode _cell : encode _cell , encode _range : encode _range , decode _col : decode _col , decode _row : decode _row , split _cell : split _cell , decode _cell : decode _cell , decode _range : decode _range , format _cell : format _cell , get _formulae : sheet _to _formulae , make _csv : sheet _to _csv , make _json : sheet _to _json , make _formulae : sheet _to _formulae , aoa _to _sheet : aoa _to _sheet , table _to _sheet : parse _dom _table , table _to _book : table _to _book , sheet _to _csv : sheet _to _csv , sheet _to _json : sheet _to _json , sheet _to _formulae : sheet _to _formulae , sheet _to _row _object _array : sheet _to _json } ; if ( has _buf && typeof require != "undefined" ) ( function ( ) { var Readable = require ( "stream" ) . Readable ; var write _csv _stream = function ( sheet , opts ) { var stream = Readable ( ) ; var out = "" ; var o = opts == null ? { } : opts ; if ( sheet == null || sheet [ "!ref" ] == null ) { stream . push ( null ) ; return stream } var r = safe _decode _range ( sheet [ "!ref" ] ) ; var FS = o . FS !== undefined ? o . FS : "," , fs = FS . charCodeAt ( 0 ) ; var RS = o . RS !== undefined ? o . RS : "\n" , rs = RS . charCodeAt ( 0 ) ; var endregex = new RegExp ( ( FS == "|" ? "\\|" : FS ) + "+$" ) ; var row = "" , cols = [ ] ; o . dense = Array . isArray ( sheet ) ; for ( var C = r . s . c ; C <= r . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; var R = r . s . r ; stream . _read = function ( ) { if ( R > r . e . r ) return stream . push ( null ) ; while ( R <= r . e . r ) { row = make _csv _row ( sheet , r , R , cols , fs , rs , FS , o ) ; if ( row == null ) { ++ R ; continue } if ( o . strip ) row = row . replace ( endregex , "" ) ; stream . push ( row + RS ) ; ++ R ; break } } ; return stream } ; var HTML _BEGIN = "<html><body><table>" ; var HTML _END = "</table></body></html>" ; var write _html _stream = function ( sheet , opts ) { var stream = Readable ( ) ; var o = [ ] ; var r = decode _range ( sheet [ "!ref" ] ) , cell ; o . dense = Array . isArray ( sheet ) ; stream . push ( HTML _BEGIN ) ; var R = r . s . r ; var end = false ; stream . _read = function ( ) { if ( R > r . e . r ) { if ( ! end ) { end = true ; stream . push ( HTML _END ) } return stream . push ( null ) } while ( R <= r . e . r ) { stream . push ( HTML _ . _row ( sheet , r , R , o ) ) ; ++ R ; break } } ; return stream } ; XLSX . stream = { to _html : write _html _stream , to _csv : write _csv _stream } } ) ( ) ; XLSX . parse _xlscfb = parse _xlscfb ; XLSX . parse _ods = parse _ods ; XLSX . parse _fods = parse _fods ; XLSX . write _ods = write _ods ; XLSX . parse _zip = parse _zip ; XLSX . read = readSync ; XLSX . readFile = readFileSync ; XLSX . readFileSync = readFileSync ; XLSX . write = writeSync ; XLSX . writeFile = writeFileSync ; XLSX . writeFileSync = writeFileSync ; XLSX . writeFileAsync = writeFileAsync ; XLSX . utils = utils ; XLSX . CFB = CFB ; XLSX . SSF = SSF } ) ( typeof exports !== "undefined" ? exports : XLSX ) ; var XLS = XLSX ; var ODS = XLSX ;