2016-12-31 08:20:45 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-04-21 22:02:02 +00:00
var XLSX = { } ; ( function make _xlsx ( XLSX ) { XLSX . version = "0.9.12" ; 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 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.0" ; 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 table _fmt = { 0 : "General" , 1 : "0" , 2 : "0.00" , 3 : "#,##0" , 4 : "#,##0.00" , 9 : "0%" , 10 : "0.00%" , 11 : "0.00E+00" , 12 : "# ?/?" , 13 : "# ??/??" , 14 : "m/d/yy" , 15 : "d-mmm-yy" , 16 : "d-mmm" , 17 : "mmm-yy" , 18 : "h:mm AM/PM" , 19 : "h:mm:ss AM/PM" , 20 : "h:mm" , 21 : "h:mm:ss" , 22 : "m/d/yy h:mm" , 37 : "#,##0 ;(#,##0)" , 38 : "#,##0 ;[Red](#,##0)" , 39 : "#,##0.00;(#,##0.00)" , 40 : "#,##0.00;[Red](#,##0.00)" , 45 : "mm:ss" , 46 : "[h]:mm:ss" , 47 : "mmss.0" , 48 : "##0.0E+0" , 49 : "@" , 56 : '"上午/下午 "hh"時"mm"分"ss"秒 "' , 6553
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 ( o . size >= 4096 ) { o . storage = "fat" ; if ( sector _list [ o . start ] === undefined ) sector _list [ o . start ] = get _sector _list ( sectors , o . start , sector _list . fat _addrs , sector _list . ssz ) ; sector _list [ o . start ] . name = o . name ; o . content = sector _list [ o . start ] . data . slice ( 0 , o . size ) ; prep _blob ( o . content , 0 ) } else { o . storage = "minifat" ; if ( minifat _store !== ENDOFCHAIN && o . start !== ENDOFCHAIN ) { o . content = sector _list [ minifat _store ] . data . slice ( o . start * MSSZ , o . start * MSSZ + o . size ) ; prep _blob ( o . content , 0 ) } } files [ name ] = o ; FileIndex . p
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 _STRING } , 16 : { n : "LinksDirty" , t : VT _BOOL } , 17 : { n : "CharacterCount" , t : VT _I4 } , 19 : { n : "SharedDoc" , t : VT _BOOL } , 22 : { n : "HLinksChanged" , t : VT _BOOL } , 23 : { n : "AppVersion" , t : VT _I4 , p : "version" } , 26 : { n : "ContentType" , t : VT _STRING } , 27 : { n : "ContentStatus" , t : VT _STRING } , 28 : { n : "Language" , t : VT _STRING } , 29 : { n : "Version" , t : VT _STRING } , 255 : { } } ; var SummaryPIDSI = { 1 : { n : "CodePage" , t : VT _I2 } , 2 : { n : "Title" , t : VT _STRING } , 3 : { n : "Subject" , t : VT _STRING } , 4 : { n : "Author" , t : VT _STRING } , 5 : { n : "Keywords" , t : VT _STRING } , 6 : { n : " Comme
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 ; return url } ; var parse _FileMoniker = function ( blob , length ) { var cAnti = blob . read _shift ( 2 ) ; var ansiLength = blob . read _shift ( 4 ) ; var ansiPath = blob . read _shift ( ansiLength , "cstr" ) ; var endServer = blob . read _shift ( 2 ) ; var versionNumber = blob . read _shift ( 2 ) ; var cbUnicodePathSize = blob . read _shift ( 4 ) ; if ( cbUnicodePathSize === 0 ) return ansiPath . replace ( /\\/g , "/" ) ; var cbUnicodePathBytes = blob . read _shift ( 4 ) ; var usKeyValue = blob . read _shift ( 2 ) ; var unicodePath = blob . read _shift ( cbUnicodePathBytes >> 1 , "utf16le" ) . replace ( chr0 , "" ) ; return unicodePath } ; var parse _HyperlinkMoniker = function ( blob , length ) { var clsid = blob . read _shift ( 16 ) ; length -= 16 ; switch ( clsid ) { case "e0c9ea79f9bace118c8200aa004ba90b" : re
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 ; for ( ; ri !== records . length ; ++ ri ) { var record = records [ ri ] . trim ( ) . split ( ";" ) ; var RT = record [ 0 ] , val ; if ( RT === "P" ) for ( rj = 1 ; rj < record . length ; ++ rj ) switch ( record [ rj ] . charAt ( 0 ) ) { case "P" : formats . push ( record [ rj ] . substr ( 1 ) ) ; break } else if ( RT !== "C" && RT !== "F" ) continue ; else for ( rj = 1 ; rj < record . length ; ++ rj ) switch ( record [ rj ] . charAt ( 0 ) ) { case "Y" : R = parseInt ( record [ rj ] . substr ( 1 ) ) - 1 ; C = 0 ; for ( var 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 && next _cell _format . match ( /[ymdhmsYMDHMS]/ ) ) 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 ) ) ] } } return arr } function sylk _to _sheet ( str , opts ) { return aoa _to _sheet ( sylk _to _aoa ( str , opts ) , opts ) } 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 ; break ; case "b" : o += cell . v ? "TRUE" : "FALSE" ; break ; case "e" : o += cell . w || cell . v ; break ; case "d" : o += '"' + ( cell . w || cell . v ) + '"' ; break ; case "s" : o += '"' + cell . v . replace ( /"/g , "" ) + '"' ; break } return o } function sheet _to _sylk ( ws , opts ) { var preamble = [ "ID;PWXL;N;E" ] , o = [ ] ; preamble . push ( "P;PGeneral" ) ; var r = decode _range ( ws [ "!ref" ] ) , cell ; var dense = Array . isArray ( ws ) ; for ( var R = r . s . r ; R <= r . e . r ; ++ R ) { for ( var C = r . s . c ; C <= r . e . c ; ++ C ) { var coord = encode _cell ( { r : R , c : C } ) ; cell = dense ? ( ws [ R ] || [ ] ) [ C ] : ws [ coord ] ; if ( ! cell || cell . v == null ) continue ; o . push ( write _ws _cell _sylk ( cell , ws , R , C , opts ) ) } } preamble . push ( "F;P0;DG0G8;M255" ) ; var RS = "\r\n" ; return preamble . join ( RS ) + RS + o . join ( RS ) + RS + "E" + RS } return { to _workbook : sylk _to _workbook , to _sheet : sylk _to _sheet , from _sheet : sheet _to _sylk } } ( ) ; var DIF = function ( ) { function dif _to _aoa ( d , opts ) { switch ( opts . type ) { case "base64" : return dif _to _aoa _str ( Base64 . decode ( d ) , opts ) ; case "binary" : return dif _to _aoa _str ( d , opts ) ; case "buffer" : return dif _to _aoa _str ( d . toString ( "binary" ) , opts ) ; case "array" : return dif _to _aoa _str ( cc2str ( d ) , opts ) } throw new Error ( "Unrecognized type " + opts . type ) } function dif _to _aoa _str ( str , opts ) { var records = str . split ( "\n" ) , R = - 1 , C = - 1 , ri = 0 , arr = [ ] ; for ( ; ri !== records . length ; ++ ri ) { if ( records [ ri ] . trim ( ) === "BOT" ) { arr [ ++ R ] = [ ] ; C = 0 ; continue } if ( R < 0 ) continue ; var metadata = records [ ri ] . trim ( ) . split ( "," ) ; var type = metadata [ 0 ] , value = metadata [ 1 ] ; ++ ri ; var data = records [ ri ] . trim ( ) ; switch ( + type ) { case - 1 : if ( data === "BOT" ) { arr [ ++ R ] = [ ] ; C = 0 ; continue } else if ( data !== "EOD" ) throw
} 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 . fgColor . theme = parseInt ( y . theme , 10 ) ; if ( y . tint ) fill . fgColor . tint = parseFloat ( y . tint ) ; if ( y . rgb ) fill . fgColor . rgb = y . rgb . slice ( - 6 ) ; break ; case "<fgColor/>" : case "</fgColor>" : break ; case "<stop" : case "<stop/>" : break ; case "</stop>" : break ; case "<color" : case "<color/>" : break ; case "</color>" : break ; default : if ( opts && opts . WTF ) throw new Error ( "unrecognized " + y [ 0 ] + " in fills" ) } } ) } function parse _fonts ( t , styles , themes , opts ) { styles . Fonts = [ ] ; var font = { } ; t [ 0 ] . match ( tagregex ) . forEach ( function ( x ) { var y = parsexmltag ( x ) ; switch ( y [ 0 ] ) { case "<fonts" : case "<fonts>" : case "</fonts>" : break ; case "<font" : case "<font>" : break ; case "</font>" : case "<font/>" : styles . Fonts . push ( font ) ; font = { } ; break ; case "<name" : if ( y . val ) font . name = y . val ; break ; case "<name/>" : case "</name>" : break ; case "<b" : break ; case "<b/>" : font . bold = true ; break ; case "<i" : break ; case "<i/>" : font . italic = true ; break ; case "<u" : font . underline = true ; break ; case "<u/>" : font . underline = true ; break ; case "<strike" : break ; case "<strike/>" : font . strike = true ; break ; case "<outline/>" : font . outline = true ; break ; case "<shadow/>" : font . shadow = true ; break ; case "<sz" : if ( y . val ) font . sz = y . val ; break ; case "<sz/>" : case "</sz>" : break ; case "<vertAlign" : if ( y . val ) font . vertAlign = y . val ; break ; case "<vertAlign/>" : case "</vertAlign>" : break ; case "<family" : if ( y . val ) font . family = y . val ; break ; case "<family/>" : case "</family>" : break ; case "<scheme" : if ( y . val ) font . scheme = y . val ; break ; case "<scheme/>" : case "</scheme>" : break ; case "<charset" : if ( y . val == "1" ) break ; y . codepage = CS2CP [ parseInt ( y . val , 10 ) ] ; break ; case "<color" : if ( ! font . color ) font . color = { } ; if ( y . theme ) font . color . theme = y . theme ; if ( y . tint ) font . color . tint = y . tint ; if ( y . theme && themes . themeElements && themes . themeElements . clrScheme ) { font . color . rgb = rgb _tint ( themes . themeElements . clrScheme [ font . color . theme ] . rgb , font . color . tint || 0 ) } if ( y . rgb ) font . color . rgb = y . rgb ; break ; case "<color/>" : case "</color>" : break ; default : if ( opts && opts . WTF ) throw new Error ( "unrecognized " + y [ 0 ] + " in fonts" ) } } ) } function parse _numFmts ( t , styles , opts ) { styles . NumberFmt = [ ] ; var k = keys ( SSF . _table ) ; for ( var i = 0 ; i < k . length ; ++ i ) styles . NumberFmt [ k [ i ] ] = SSF . _table [ k [ i ] ] ; var m = t [ 0 ] . match ( tagregex ) ; if ( ! m ) return ; for ( i = 0 ; i < m . length ; ++ i ) { var y = parsexmltag ( m [ i ] ) ; switch ( y [ 0 ] ) { case "<numFmts" : case "</numFmts>" : case "<numFmts/>" : case "<numFmts>" : break ; case "<numFmt" : { var f = unescapexml ( utf8read ( y . formatCode ) ) , j = parseInt ( y . numFmtId , 10 ) ; styles . NumberFmt [ j ] = f ; if ( j > 0 ) SSF . load ( f , j ) } break ; case "</numFmt>" : break ; default : if ( opts . WTF ) throw new Error ( "unrecognized " + y [ 0 ] + " in numFmts" ) } } } function write _numFmts ( NF , opts ) { var o = [ "<numFmts>" ] ; [ [ 5 , 8 ] , [ 23 , 26 ] , [ 41 , 44 ] , [ 50 , 392 ] ] . forEach ( function ( r ) { for ( var i = r [ 0 ] ;
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 _RgceAreaRel ( blob , length , opts ) { var r = blob . read _shift ( length == 12 ? 4 : 2 ) , R = blob . read _shift ( length == 12 ? 4 : 2 ) ; 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 _RgceLoc ( blob , length , opts ) { if ( opts && opts . biff >= 2 && opts . biff <= 5 ) return parse _RgceLoc _BIFF2 ( blob , length , opts ) ; var r = blob . read _shift ( opts && opts . biff == 12 ? 4 : 2 ) ; var c = parse _ColRelU ( blob , 2 ) ; return { r : r , c : c [ 0 ] , cRel : c [ 1 ] , rRel : c [ 2 ] } } function parse _RgceLoc _BIFF2 ( blob , length , opts ) { var r = parse _ColRelU ( blob , 2 ) ; var c = blob . read _shift ( 1 ) ; return { r : r [ 0 ] , c : c , cRel : r [ 1 ] , rRel : r [ 2 ] } } function parse _RgceLocRel ( blob , length , opts ) { var biff = opts && opts . biff ? opts . biff : 8 ; if ( biff >= 2 && biff <= 5 ) return parse _RgceLocRel _BIFF2 ( blob , length , opts ) ; var r = blob . read _shift ( biff >= 12 ? 4 : 2 ) ; var cl = blob . read _shift ( 2 ) ; var cRel = ( cl & 32768 ) >> 15 , rRel = ( cl & 16384 ) >> 14 ; cl &= 16383 ; if ( rRel == 1 ) while ( r > 524287 ) r -= 1048576 ; if ( cRel == 1 ) while ( cl > 8191 ) cl = cl - 16384 ; return { r : r , c : cl , cRel : cRel , rRel : rRel } } function parse _RgceLocRel _BIFF2 ( blob , length ) { var rl = blob . read _shift ( 2 ) ; var c = blob . read _shift ( 1 ) ; var rRel = ( rl & 32768 ) >> 15 , cRel = ( rl & 16384 ) >> 14 ; rl &= 16383 ; if ( rRel == 1 && rl >= 8192 ) rl = rl - 16384 ; if ( cRel == 1 && c >= 128 ) c = c - 256 ; return { r : rl , c : c , cRel : cRel , rRel : rRel } } function parse _PtgArea ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var area = parse _RgceArea ( blob , opts . biff >= 2 && opts . biff <= 5 ? 6 : 8 , opts ) ; return [ type , area ] } function parse _PtgArea3d ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var ixti = blob . read _shift ( 2 , "i" ) ; var w = 8 ; if ( opts ) switch ( opts . biff ) { case 5 : blob . l += 12 ; w = 6 ; break ; case 12 : w = 12 ; break } var area = parse _RgceArea ( blob , w , opts ) ; return [ type , ixti , area ] } function parse _PtgAreaErr ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; blob . l += opts && opts . biff > 8 ? 12 : 8 ; return [ type ] } function parse _PtgAreaErr3d ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var ixti = blob . read _shift ( 2 ) ; var w = 8 ; if ( opts ) switch ( opts . biff ) { case 5 : blob . l += 12 ; w = 6 ; break ; case 12 : w = 12 ; break } blob . l += w ; return [ type , ixti ] } function parse _PtgAreaN ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; var area = parse _RgceAreaRel ( blob , opts && opts . biff > 8 ? 12 : 8 , opts ) ; return [ type , area ] } function parse _PtgArray ( blob , length , opts ) { var type = ( blob [ blob . l ++ ] & 96 ) >> 5 ; blob . l += opts . biff == 2 ? 6 : opts . biff == 12 ? 14 : 7 ; return [ type ] } function parse _PtgAttrBaxcel ( blob , length ) { var bitSemi = blob [ blob . l + 1 ] & 1 ; var bitBaxcel = 1 ; blob . l += 4 ; return [ bitSemi , bitBaxcel ] } function parse _PtgAttrChoose ( blob , length , opts ) { blob . l += 2 ; var offset = blob . read _shift ( opts && opts . biff == 2 ? 1 : 2 ) ; var o = [ ] ; for ( var i = 0 ; i <= offset ; ++ i ) o . push ( blob . read _shift ( opts && opts . biff == 2 ? 1 : 2 ) ) ; return o } function parse _PtgAttrGoto ( blob , length , opts ) { var bitGoto = blob [ blob . l + 1 ] & 255 ? 1 : 0 ; blob . l += 2
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" , 396 : "IMSUB" , 397 : "IMDIV" , 398 : "IMPOWER" , 399 : "IMABS" , 400 : "IMSQRT" , 401 : "IMLN" , 402 : "IMLOG2" , 403 : "IMLOG10" , 404 : "IMSIN" , 405 : "IMCOS" , 406 : "IMEXP" , 407 : "IMARGUMENT" , 408 : "IMCONJUGATE" , 409 : "IMAGINARY" , 410 : "IMREAL" , 411 : "COMPLEX" , 412 : "IMSUM" , 413 : "IMPRODUCT" , 414 : "SERIESSUM" , 415 : "FACTDOUBLE" , 416 : "SQRTPI" , 417 : "QUOTIENT" , 418 : "DELTA" , 419 : "GESTEP" , 420 : "ISEVEN" , 421 : "ISODD" , 422 : "MROUND" , 423 : "ERF" , 424 : "ERFC" , 425 : "BESSELJ" , 426 : "BESSELK" , 427 : "BESSELY" , 428 : "BESSELI" , 429 : "XIRR" , 430 : "XNPV" , 431 : "PRICEMAT" , 432 : "YIELDMAT" , 433 : "INTRATE" , 434 : "RECEIVED" , 435 : "DISC" , 436 : "PRICEDISC" , 437 : "YIELDDISC" , 438 : "TBILLEQ" , 439 : "TBILLPRICE" , 440 : "TBILLYIELD" , 441 : "PRICE" , 442 : "YIELD" , 443 : "DOLLARDE" , 444 : "DOLLARFR" , 445 : "NOMINAL" , 446 : "EFFECT" , 447 : "CUMPRINC" , 448 : "CUMIPMT" , 449 : "EDATE" , 450 : "EOMONTH" , 451 : "YEARFRAC" , 452 : "COUPDAYBS" , 453 : "COUPDAYS" , 454 : "COUPDAYSNC" , 455 : "COUPNCD" , 456 : "COUPNUM" , 457 : "COUPPCD" , 458 : "DURATION" , 459 : "MDURATION" , 460 : "ODDLPRICE" , 461 : "ODDLYIELD" , 462 : "ODDFPRICE" , 463 : "ODDFYIELD" , 464 : "RANDBETWEEN" , 465 : "WEEKNUM" , 466 : "AMORDEGRC" , 467 : "AMORLINC" , 468 : "CONVERT" , 724 : "SHEETJS" , 469 : "ACCRINT" , 470 : "ACCRINTM" , 471 : "WORKDAY" , 472 : "NETWORKDAYS" , 473 : "GCD" , 474 : "MULTINOMIAL" , 475 : "LCM" , 476 : "FVSCHEDULE" , 477 : "CUBEKPIMEMBER" , 478 : "CUBESET" , 479 : "CUBESETCOUNT" , 480 : "IFERROR" , 481 : "COUNTIFS" , 482 : "SUMIFS" , 483 : "AVERAGEIF" , 484 : "AVERAGEIFS" } ; var FtabArgc = { 2 : 1 , 3 : 1 , 15 : 1 , 16 : 1 , 17 : 1 , 18 : 1 , 19 : 0 , 20 : 1 , 21 : 1 , 22 : 1 , 23 : 1 , 24 : 1 , 25 : 1 , 26 : 1 , 27 : 2 , 30 : 2 , 31 : 3 , 32 : 1 , 33 : 1 , 38 : 1 , 39 : 2 , 40 : 3 , 41 : 3 , 42 : 3 , 43 : 3 , 44 : 3 , 45 : 3 , 47 : 3 , 48 : 2 , 53 : 1 , 61 : 3 , 65 : 3 , 66 : 3 , 67 : 1 , 68 : 1 , 69 : 1 , 70 : 1 , 71 : 1 , 72 : 1 , 73 : 1 , 75 : 1 , 76 : 1 , 77 : 1 , 79 : 2 , 80 : 2 , 83 : 1 , 85 : 0 , 86 : 1 , 90 : 1 , 97 : 2 , 98 : 1 , 99 : 1 , 101 : 3 , 102 : 3 , 105 : 1 , 111 : 1 , 112 : 1 , 113 : 1 , 114 : 1 , 117 : 2 , 118 : 1 , 119 : 4 , 121 : 1 , 126 : 1 , 127 : 1 , 128 : 1 , 129 : 1 , 130 : 1 , 131 : 1 , 133 : 1 , 134 : 1 , 135 : 1 , 136 : 2 , 137 : 2 , 138 : 2 , 140 : 1 , 141 : 1 , 142 : 3 , 143 : 4 , 144 : 4 , 162 : 1 , 163 : 1 , 164 : 1 , 165 : 2 , 172 : 1 , 175 : 2 , 176 : 2 , 177 : 3 , 178 : 2 , 179 : 1 , 184 : 1 , 189 : 3 , 190 : 1 , 195 : 3 , 196 : 3 , 197 : 1 , 198 : 1 , 199 : 3 , 201 : 1 , 207 : 4 , 210 : 3 , 211 : 1 , 212 : 2 , 213 : 2 , 214 : 1 , 215 : 1 , 229 : 1 , 230 : 1 , 231 : 1 , 232 : 1 , 233 : 1 , 234 : 1 , 235 : 3 , 244 : 1 , 247 : 4 , 252 : 2 , 257 : 1 , 261 : 1 , 271 : 1 , 273 : 4 , 274 : 2 , 275 : 2 , 276 : 2 , 277 : 3 , 278 : 3 , 279 : 1 , 280 : 3 , 281 : 3 , 282 : 3 , 283 : 1 , 284 : 1 , 285 : 2 , 286 : 4 , 287 : 3 , 288 : 2 , 289 : 4 , 290 : 3 , 291 : 3 , 292 : 3 , 293 : 4 , 294 : 1 , 295 : 3 , 296 : 1 , 297 : 3 , 298 : 1 , 299 : 2 , 300 : 3 , 301 : 3 , 302 : 4 , 303 : 2 , 304 : 2 , 305 : 2 , 306 : 2 , 307 : 2 , 308 : 2 , 309 : 3 , 310 : 2 , 311 : 2 , 312 : 2 , 313 : 2 , 314 : 2 , 315 : 2 , 316 : 4 , 325 : 2 , 326 : 2 , 327 : 2 , 328 : 2 , 331 : 2 , 332 : 2 , 337 : 2 , 342 : 1 , 343 : 1 , 346 : 2 , 347 : 1 , 350 : 4 , 351 : 3 , 352 : 1 , 353 : 2 , 360 : 1 , 368 : 1 , 369 : 1 , 370 : 1 , 371 : 1 , 372 : 1 , 373 : 1 , 374 : 1 , 375 : 1 , 376 : 1 , 377 : 1 , 378 : 1 , 382 : 3 , 385 : 1 , 392 : 1 , 393 : 1 , 396 : 2 , 397 : 2 , 398 : 2 , 399 : 1 , 400 : 1 , 401 : 1 , 402 : 1 , 403 : 1 , 404 : 1 , 405 : 1 , 406 : 1 , 407 : 1 , 408 : 1 , 409 : 1 , 410 : 1 , 414 : 4 , 415 : 1 , 416 : 1 , 417 : 2 , 420 : 1 , 421 : 1 , 422 : 2 , 424 : 1 , 425 : 2 , 426 : 2 , 427 : 2 , 428 : 2 , 430 : 3 , 438 : 3 , 439 : 3 , 440 : 3 , 443 : 2 , 444 : 2 , 445 : 2 , 446 : 2 , 447 : 6 , 448 : 6 , 449 : 2 , 450 : 2 , 464 : 2 , 468 : 3 , 476 : 2 , 479
if ( _d ) { p . t = "d" ; p . v = new Date ( Date . UTC ( _d . y , _d . m - 1 , _d . d , _d . H , _d . M , _d . S , _d . u ) ) } } break ; case 1 : if ( ! opts . sheetStubs ) break ; p = { t : "z" , v : undefined } ; C = val [ 0 ] . c ; if ( opts . dense ) { if ( ! s [ R ] ) s [ R ] = [ ] ; s [ R ] [ C ] = p } else s [ encode _col ( C ) + rr ] = p ; 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 ; break ; case 176 : mergecells . push ( val ) ; break ; case 494 : var rel = rels [ "!id" ] [ val . relId ] ; if ( rel ) { val . Target = rel . Target ; if ( val . loc ) val . Target += "#" + val . loc ; val . Rel = rel } for ( R = val . rfx . s . r ; R <= val . rfx . e . r ; ++ R ) for ( C = val . rfx . s . c ; C <= val . rfx . e . c ; ++ C ) { if ( opts . dense ) { if ( ! s [ R ] ) s [ R ] = [ ] ; if ( ! s [ R ] [ C ] ) s [ R ] [ C ] = { t : "z" , v : undefined } ; s [ R ] [ C ] . l = val } else { addr = encode _cell ( { c : C , r : R } ) ; if ( ! s [ addr ] ) s [ addr ] = { t : "z" , v : undefined } ; s [ addr ] . l = val } } break ; case 426 : if ( ! opts . cellFormula ) break ; array _formulae . push ( val ) ; cell = opts . dense ? s [ R ] [ C ] : s [ encode _col ( C ) + rr ] ; cell . f = stringify _formula ( val [ 1 ] , refguess , { r : row . r , c : C } , supbooks , opts ) ; cell . F = encode _range ( val [ 0 ] ) ; break ; case 427 : if ( ! opts . cellFormula ) break ; shared _formulae [ encode _cell ( val [ 0 ] . s ) ] = val [ 1 ] ; cell = opts . dense ? s [ R ] [ C ] : s [ encode _col ( C ) + rr ] ; cell . f = stringify _formula ( val [ 1 ] , refguess , { r : row . r , c : C } , supbooks , opts ) ; break ; case 60 : 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 161 : s [ "!autofilter" ] = { ref : encode _range ( val ) } ; break ; case 476 : s [ "!margins" ] = val ; break ; case 175 : case 644 : case 625 : case 562 : case 396 : case 1112 : case 1146 : case 471 : case 1050 : case 649 : case 1105 : case 49 : case 589 : case 607 : case 564 : case 1055 : case 168 : case 174 : case 1180 : case 499 : case 64 : case 1053 : case 550 : case 171 : case 167 : case 1177 : case 169 : case 1181 : case 551 : case 552 : case 661 : case 639 : case 478 : case 151 : case 537 : case 477 : case 536 : case 1103 : case 680 : case 1104 : case 1024 : case 152 : case 663 : case 535 : case 678 : case 504 : case 1043 : case 428 : case 170 : case 50 : case 2070 : case 485 : case 1045 : case 147 : 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 ) } } , opts ) ; delete opts . supbooks ; delete opts [ "!row" ] ; if ( ! s [ "!ref" ] && ( refguess . s . r < 2e6 || ref && ( ref . e . r > 0 || ref . e . c > 0 || ref . s . r > 0 || ref . s . c > 0 ) ) ) s [ "!ref" ] = encode _range ( ref || refguess ) ; if ( opts . sheetRows && s [ "!ref" ] ) { var tmpref = safe _decode _range ( s [ "!ref" ] ) ; if ( opts . sheetRows < + tmpref . e . r ) { tmpref . e . r = opts . sheetRows - 1 ; if ( tmpref . e . r > refguess . e . r ) tmpref . e . r = refguess . e . r ; if ( tmpref . e . r < tmpref . s . r ) tmpref . s . r = tmpref . e . r ; if ( tmpref . e . c > refguess . e . c ) tmpref . e . c = refguess . e . c ; if ( tmpref . e . c < tmpref . s . c ) tmpref . s . c = tmpref . e . c ; s [ "!fullref" ] = s [ "!ref" ] ; s [ "!ref" ] = encode _range ( tmpref ) } } if ( mergecells . length > 0 ) s [ "!merges" ] = mergecells ; if ( colinfo . length > 0 ) s [ "!cols" ] = colinfo ; if ( rowinfo . length > 0 ) s [ "!rows" ] = rowinfo ; return s } function write _ws _bin _cell ( ba , cell , R , C , opts , ws ) { if ( cell . v === undefined ) return "" ; var vv = "" ; var olddate = null ; switch ( cell . t ) { case "b" : vv = cell . v ? "1" : "0" ; break ; case "d" : cell . z = cell . z || SSF . _table [ 14 ] ; olddate = cell . v ; cell . v = datenum ( cell . v ) ; cell . t = "n" ; break ; case "n" : case "e" : vv = "" + cell . v ; break ; default : vv = cell . v ; break } var o = { r : R , c : C } ; if ( cell . l ) ws [ "!links" ] . push ( [ encode _cell ( o ) , cell . l ] ) ; if ( cell . c ) ws [ "!comments" ] . push ( [ encode _cell ( o ) , cell . c ] ) ; switch ( cell . t ) { case "s" : case "str" : if ( opts . bookSST ) { vv = get _sst _id ( opts . Strings , cell . v ) ; o . t = "s" ; o . v = vv ; write _record ( ba , "BrtCellIsst" , write _BrtCellIsst ( cell , o ) ) } else { o . t = "str" ; write _record ( ba , "BrtCellSt" , write _BrtCellSt ( cell , o ) ) } return ; case "n" : if ( cell . v == ( cell . v | 0 ) && cell . v > - 1e3 && cell . v < 1e3 ) write _record ( ba , "BrtCellRk" , write _BrtCellRk ( cell , o ) ) ; else write _record ( ba , "BrtCellReal" , write _BrtCellReal ( cell , o ) ) ; if ( olddate ) { cell . t = "d" ; cell . v = olddate } return ; case "b" : o . t = "b" ; write _record ( ba , "BrtCellBool" , write _BrtCellBool ( cell , o ) ) ; return ; case "e" : o . t = "e" ; break } write _record ( ba , "BrtCellBlank" , write _BrtCellBlank ( cell , o ) ) } function write _CELLTABLE ( ba , ws , idx , opts , wb ) { var range = safe _decode _range ( ws [ "!ref" ] || "A1" ) , ref , rr = "" , cols = [ ] ; write _record ( ba , "BrtBeginSheetData" ) ; var dense = Array . isArray ( ws ) ; for ( var
case "AutoFilter" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw new Error ( "Bad state: " + tmp . join ( "|" ) ) } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) { var AutoFilter = xlml _parsexmltag ( Rn [ 0 ] ) ; cursheet [ "!autofilter" ] = { ref : rc _to _a1 ( AutoFilter . Range ) . replace ( /\$/g , "" ) } ; state . push ( [ Rn [ 3 ] , true ] ) } break ; case "Name" : break ; case "ComponentOptions" : case "DocumentProperties" : case "CustomDocumentProperties" : case "OfficeDocumentSettings" : case "PivotTable" : case "PivotCache" : case "Names" : case "MapInfo" : case "PageBreaks" : case "QueryTable" : case "DataValidation" : case "Sorting" : case "Schema" : case "data" : case "ConditionalFormatting" : case "SmartTagType" : case "SmartTags" : case "ExcelWorkbook" : case "WorkbookOptions" : case "WorksheetOptions" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw new Error ( "Bad state: " + tmp . join ( "|" ) ) } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) state . push ( [ Rn [ 3 ] , true ] ) ; break ; default : if ( state . length == 0 && Rn [ 3 ] == "document" ) return parse _fods ( str , opts ) ; if ( state . length == 0 && Rn [ 3 ] == "UOF" ) return parse _fods ( str , opts ) ; var seen = true ; switch ( state [ state . length - 1 ] [ 0 ] ) { case "OfficeDocumentSettings" : switch ( Rn [ 3 ] ) { case "AllowPNG" : break ; case "RemovePersonalInformation" : break ; case "DownloadComponents" : break ; case "LocationOfComponents" : break ; case "Colors" : break ; case "Color" : break ; case "Index" : break ; case "RGB" : break ; case "PixelsPerInch" : break ; case "TargetScreenSize" : break ; case "ReadOnlyRecommended" : break ; default : seen = false } break ; case "ComponentOptions" : switch ( Rn [ 3 ] ) { case "Toolbar" : break ; case "HideOfficeLogo" : break ; case "SpreadsheetAutoFit" : break ; case "Label" : break ; case "Caption" : break ; case "MaxHeight" : break ; case "MaxWidth" : break ; case "NextSheetNumber" : break ; default : seen = false } break ; case "ExcelWorkbook" : switch ( Rn [ 3 ] ) { case "WindowHeight" : break ; case "WindowWidth" : break ; case "WindowTopX" : break ; case "WindowTopY" : break ; case "TabRatio" : break ; case "ProtectStructure" : break ; case "ProtectWindows" : break ; case "ActiveSheet" : break ; case "DisplayInkNotes" : break ; case "FirstVisibleSheet" : break ; case "SupBook" : break ; case "SheetName" : break ; case "SheetIndex" : break ; case "SheetIndexFirst" : break ; case "SheetIndexLast" : break ; case "Dll" : break ; case "AcceptLabelsInFormulas" : break ; case "DoNotSaveLinkValues" : break ; case "Date1904" : break ; case "Iteration" : break ; case "MaxIterations" : break ; case "MaxChange" : break ; case "Path" : break ; case "Xct" : break ; case "Count" : break ; case "SelectedSheets" : break ; case "Calculation" : break ; case "Uncalced" : break ; case "StartupPrompt" : break ; case "Crn" : break ; case "ExternName" : break ; case "Formula" : break ; case "ColFirst" : break ; case "ColLast" : break ; case "WantAdvise" : break ; case "Boolean" : break ; case "Error" : break ; case "Text" : break ; case "OLE" : break ; case "NoAutoRecover" : break ; case "PublishObjects" : break ; case "DoNotCalculateBeforeSave" : break ; case "Number" : break ; case "RefModeR1C1" : break ; case "EmbedSaveSmartTags" : break ; default : seen = false } break ; case "WorkbookOptions" : switch ( Rn [ 3 ] ) { case "OWCVersion" : break ; case "Height" : break ; case "Width" : break ; default : seen = false } break ; case "WorksheetOptions" : switch ( Rn [ 3 ] ) { case "Visible" : if ( Rn [ 0 ] . slice ( - 2 ) === "/>" ) { } else if ( Rn [ 1 ] === "/" ) switch ( str . slice ( pidx , Rn . index ) ) { case "SheetHidden" : wsprops . Hidden = 1 ; break ; case "SheetVeryHidden" : wsprops . Hidden = 2 ; break } else pidx = Rn . index + Rn [ 0 ] . length ; break ; case "Header" : if ( ! cursheet [ "!margins" ] ) default _margins ( cursheet [ "!margins" ] = { } , "xlml" ) ; cursheet [ "!margins" ] . header = parsexmltag ( Rn [ 0 ] ) . Margin ; break ; case "Footer" : if ( ! cursheet [ "!margins" ] ) default _margins ( cursheet [ "!margins" ] = { } , "xlml" ) ; cursheet [ "!margins" ] . footer = parsexmltag ( Rn [ 0 ] ) . Margin ; break ; case "PageMargins" : var pagemargins = parsexmltag ( Rn [ 0 ] ) ; if ( ! cursheet [ "!margins" ] ) default _margins ( cursheet [ "!margins" ] = { } , "xlml" ) ; if ( pagemargins . Top ) cursheet [ "!margins" ] . top = pagemargins . Top ; if ( pagemargins . Left ) cursheet [ "!margins" ] . left = pagemargins . Left ; if ( pagemargins . Right ) cursheet [ "!margins" ] . right = pagemargins . Right ; if ( pagemargins . Bottom ) cursheet [ "!margins" ] . bottom = pagemargins . Bottom ; break ; case "Unsynced" : break ; case "Print" : break ; case "Panes" : break ; case "Scale" : break ; case "Pane" : break ; case "Number" : break ; case "Layout" : break ; case "PageSetup" : break ; case "Selected" : break ; case "ProtectObjects" : break ; case "EnableSelection" : break ; case "ProtectScenarios" : break ; case " ValidPri
case "BopPop" : case "BopPopCustom" : case "RealTimeData" : case "Name" : break ; default : if ( options . WTF ) throw "Unrecognized Record " + R . n } } } } } else blob . l += length } var sheetnamesraw = Object . keys ( Directory ) . sort ( function ( a , b ) { return Number ( a ) - Number ( b ) } ) . map ( function ( x ) { return Directory [ x ] . name } ) ; var sheetnames = sheetnamesraw . slice ( ) ; wb . Directory = sheetnamesraw ; wb . SheetNames = sheetnamesraw ; if ( ! options . bookSheets ) wb . Sheets = Sheets ; if ( wb . Sheets ) FilterDatabases . forEach ( function ( r , i ) { wb . Sheets [ wb . SheetNames [ i ] ] [ "!autofilter" ] = r } ) ; wb . Preamble = Preamble ; wb . Strings = sst ; wb . SSF = SSF . get _table ( ) ; if ( opts . enc ) wb . Encryption = opts . enc ; wb . Metadata = { } ; if ( country !== undefined ) wb . Metadata . Country = country ; if ( supbooks . names . length > 0 ) Workbook . Names = supbooks . names ; wb . Workbook = Workbook ; return wb } function parse _xlscfb ( cfb , options ) { if ( ! options ) options = { } ; fix _read _opts ( options ) ; reset _cp ( ) ; var CompObj , Summary , Workbook ; if ( cfb . FullPaths ) { CompObj = cfb . find ( "!CompObj" ) ; Summary = cfb . find ( "!SummaryInformation" ) ; Workbook = cfb . find ( "/Workbook" ) } else { prep _blob ( cfb , 0 ) ; Workbook = { content : cfb } } if ( ! Workbook ) Workbook = cfb . find ( "/Book" ) ; var CompObjP , SummaryP , WorkbookP ; if ( CompObj ) CompObjP = parse _compobj ( CompObj ) ; if ( options . bookProps && ! options . bookSheets ) WorkbookP = { } ; else { if ( Workbook ) WorkbookP = parse _workbook ( Workbook . content , options , ! ! Workbook . find ) ; else if ( cfb . find ( "PerfectOffice_MAIN" ) ) WorkbookP = WK _ . to _workbook ( cfb . find ( "PerfectOffice_MAIN" ) . content , options ) ; else if ( cfb . find ( "NativeContent_MAIN" ) ) WorkbookP = WK _ . to _workbook ( cfb . find ( "NativeContent_MAIN" ) . content , options ) ; else throw new Error ( "Cannot find Workbook stream" ) } if ( cfb . FullPaths ) parse _props ( cfb ) ; var props = { } ; for ( var y in cfb . Summary ) props [ y ] = cfb . Summary [ y ] ; for ( y in cfb . DocSummary ) props [ y ] = cfb . DocSummary [ y ] ; WorkbookP . Props = WorkbookP . Custprops = props ; if ( options . bookFiles ) WorkbookP . cfb = cfb ; return WorkbookP } function parse _props ( cfb ) { var DSI = cfb . find ( "!DocumentSummaryInformation" ) ; if ( DSI ) try { cfb . DocSummary = parse _PropertySetStream ( DSI , DocSummaryPIDDSI ) } catch ( e ) { } var SI = cfb . find ( "!SummaryInformation" ) ; if ( SI ) try { cfb . Summary = parse _PropertySetStream ( SI , SummaryPIDSI ) } catch ( e ) { } } var XLSBRecordEnum = { 0 : { n : "BrtRowHdr" , f : parse _BrtRowHdr } , 1 : { n : "BrtCellBlank" , f : parse _BrtCellBlank } , 2 : { n : "BrtCellRk" , f : parse _BrtCellRk } , 3 : { n : "BrtCellError" , f : parse _BrtCellError } , 4 : { n : "BrtCellBool" , f : parse _BrtCellBool } , 5 : { n : "BrtCellReal" , f : parse _BrtCellReal } , 6 : { n : "BrtCellSt" , f : parse _BrtCellSt } , 7 : { n : "BrtCellIsst" , f : parse _BrtCellIsst } , 8 : { n : "BrtFmlaString" , f : parse _BrtFmlaString } , 9 : { n : "BrtFmlaNum" , f : parse _BrtFmlaNum } , 10 : { n : "BrtFmlaBool" , f : parse _BrtFmlaBool } , 11 : { n : "BrtFmlaError" , f : parse _BrtFmlaError } , 16 : { n : "BrtFRTArchID$" , f : parse _BrtFRTArchID$ } , 19 : { n : "BrtSSTItem" , f : parse _RichStr } , 20 : { n : "BrtPCDIMissing" , f : parsenoop } , 21 : { n : "BrtPCDINumber" , f : parsenoop } , 22 : { n : "BrtPCDIBoolean" , f : parsenoop } , 23 : { n : "BrtPCDIError" , f : parsenoop } , 24 : { n : "BrtPCDIString" , f : parsenoop } , 25 : { n : "BrtPCDIDatetime" , f : parsenoop } , 26 : { n : "BrtPCDIIndex" , f : parsenoop } , 27 : { n : "BrtPCDIAMissing" , f : parsenoop } , 28 : { n : "BrtPCDIANumber" , f : parsenoop } , 29 : { n : "BrtPCDIABoolean" , f : parsenoop } , 30 : { n : "BrtPCDIAError" , f : parsenoop } , 31 : { n : "BrtPCDIAString" , f : parsenoop } , 32 : { n : "BrtPCDIADatetime" , f : parsenoop } , 33 : { n : "BrtPCRRecord" , f : parsenoop } , 34 : { n : "BrtPCRRecordDt" , f : parsenoop } , 35 : { n : "BrtFRTBegin" , f : parsenoop } , 36 : { n : "BrtFRTEnd" , f : parsenoop } , 37 : { n : "BrtACBegin" , f : parsenoop } , 38 : { n : "BrtACEnd" , f : parsenoop } , 39 : { n : "BrtName" , f : parse _BrtName } , 40 : { n : "BrtIndexRowBlock" , f : parsenoop } , 42 : { n : "BrtIndexBlock" , f : parsenoop } , 43 : { n : "BrtFont" , f : parse _BrtFont } , 44 : { n : "BrtFmt" , f : parse _BrtFmt } , 45 : { n : "BrtFill" , f : parsenoop } , 46 : { n : "BrtBorder" , f : parsenoop } , 47 : { n : "BrtXF" , f : parse _BrtXF } , 48 : { n : "BrtStyle" , f : parsenoop } , 49 : { n : "BrtCellMeta" , f : parsenoop } , 50 : { n : "BrtValueMeta" , f : parsenoop } , 51 : { n : "BrtMdb" , f : parsenoop } , 52 : { n : "BrtBeginFmd" , f : parsenoop } , 53 : { n : "BrtEndFmd" , f : parsenoop } , 54 : { n : "BrtBeginMdx" , f : parsenoop } , 55 : { n : "BrtEndMdx" , f : parsenoop } , 56 : { n : "BrtBeginMdxTuple" , f : parsenoop } , 57 : { n : "BrtEndMdxTuple" , f : parsenoop } , 58 : { n : "BrtMdxMbrIstr" , f : parsenoop } , 59 : { n : "BrtStr" , f : parsenoop } , 60 : { n : "BrtColInfo" , f : parse _ColInfo } , 62 : { n : "BrtCellRString" , f : parsenoop } , 63 : { n : "BrtCalcChainItem$" , f : parse _BrtCalcChain
} , 2084 : { n : "BrtEndTimelineCacheIDs" , f : parsenoop } , 2085 : { n : "BrtBeginTimelineCacheID" , f : parsenoop } , 2086 : { n : "BrtEndTimelineCacheID" , f : parsenoop } , 2087 : { n : "BrtBeginTimelinesEx" , f : parsenoop } , 2088 : { n : "BrtEndTimelinesEx" , f : parsenoop } , 2089 : { n : "BrtBeginTimelineEx" , f : parsenoop } , 2090 : { n : "BrtEndTimelineEx" , f : parsenoop } , 2091 : { n : "BrtWorkBookPr15" , f : parsenoop } , 2092 : { n : "BrtPCDH15" , f : parsenoop } , 2093 : { n : "BrtBeginTimelineStyle" , f : parsenoop } , 2094 : { n : "BrtEndTimelineStyle" , f : parsenoop } , 2095 : { n : "BrtTimelineStyleElement" , f : parsenoop } , 2096 : { n : "BrtBeginTimelineStylesheetExt15" , f : parsenoop } , 2097 : { n : "BrtEndTimelineStylesheetExt15" , f : parsenoop } , 2098 : { n : "BrtBeginTimelineStyles" , f : parsenoop } , 2099 : { n : "BrtEndTimelineStyles" , f : parsenoop } , 2100 : { n : "BrtBeginTimelineStyleElements" , f : parsenoop } , 2101 : { n : "BrtEndTimelineStyleElements" , f : parsenoop } , 2102 : { n : "BrtDxf15" , f : parsenoop } , 2103 : { n : "BrtBeginDxfs15" , f : parsenoop } , 2104 : { n : "brtEndDxfs15" , f : parsenoop } , 2105 : { n : "BrtSlicerCacheHideItemsWithNoData" , f : parsenoop } , 2106 : { n : "BrtBeginItemUniqueNames" , f : parsenoop } , 2107 : { n : "BrtEndItemUniqueNames" , f : parsenoop } , 2108 : { n : "BrtItemUniqueName" , f : parsenoop } , 2109 : { n : "BrtBeginExtConn15" , f : parsenoop } , 2110 : { n : "BrtEndExtConn15" , f : parsenoop } , 2111 : { n : "BrtBeginOledbPr15" , f : parsenoop } , 2112 : { n : "BrtEndOledbPr15" , f : parsenoop } , 2113 : { n : "BrtBeginDataFeedPr15" , f : parsenoop } , 2114 : { n : "BrtEndDataFeedPr15" , f : parsenoop } , 2115 : { n : "BrtTextPr15" , f : parsenoop } , 2116 : { n : "BrtRangePr15" , f : parsenoop } , 2117 : { n : "BrtDbCommand15" , f : parsenoop } , 2118 : { n : "BrtBeginDbTables15" , f : parsenoop } , 2119 : { n : "BrtEndDbTables15" , f : parsenoop } , 2120 : { n : "BrtDbTable15" , f : parsenoop } , 2121 : { n : "BrtBeginDataModel" , f : parsenoop } , 2122 : { n : "BrtEndDataModel" , f : parsenoop } , 2123 : { n : "BrtBeginModelTables" , f : parsenoop } , 2124 : { n : "BrtEndModelTables" , f : parsenoop } , 2125 : { n : "BrtModelTable" , f : parsenoop } , 2126 : { n : "BrtBeginModelRelationships" , f : parsenoop } , 2127 : { n : "BrtEndModelRelationships" , f : parsenoop } , 2128 : { n : "BrtModelRelationship" , f : parsenoop } , 2129 : { n : "BrtBeginECTxtWiz15" , f : parsenoop } , 2130 : { n : "BrtEndECTxtWiz15" , f : parsenoop } , 2131 : { n : "BrtBeginECTWFldInfoLst15" , f : parsenoop } , 2132 : { n : "BrtEndECTWFldInfoLst15" , f : parsenoop } , 2133 : { n : "BrtBeginECTWFldInfo15" , f : parsenoop } , 2134 : { n : "BrtFieldListActiveItem" , f : parsenoop } , 2135 : { n : "BrtPivotCacheIdVersion" , f : parsenoop } , 2136 : { n : "BrtSXDI15" , f : parsenoop } , 65535 : { n : "" , f : parsenoop } } ; var evert _RE = evert _key ( XLSBRecordEnum , "n" ) ; var XLSRecordEnum = { 3 : { n : "BIFF2NUM" , f : parse _BIFF2NUM } , 4 : { n : "BIFF2STR" , f : parse _BIFF2STR } , 6 : { n : "Formula" , f : parse _Formula } , 9 : { n : "BOF" , f : parse _BOF } , 10 : { n : "EOF" , f : parse _EOF } , 12 : { n : "CalcCount" , f : parse _CalcCount } , 13 : { n : "CalcMode" , f : parse _CalcMode } , 14 : { n : "CalcPrecision" , f : parse _CalcPrecision } , 15 : { n : "CalcRefMode" , f : parse _CalcRefMode } , 16 : { n : "CalcDelta" , f : parse _CalcDelta } , 17 : { n : "CalcIter" , f : parse _CalcIter } , 18 : { n : "Protect" , f : parse _Protect } , 19 : { n : "Password" , f : parse _Password } , 20 : { n : "Header" , f : parse _Header } , 21 : { n : "Footer" , f : parse _Footer } , 23 : { n : "ExternSheet" , f : parse _ExternSheet } , 24 : { n : "Lbl" , f : parse _Lbl } , 25 : { n : "WinProtect" , f : parse _WinProtect } , 26 : { n : "VerticalPageBreaks" , f : parse _VerticalPageBreaks } , 27 : { n : "HorizontalPageBreaks" , f : parse _HorizontalPageBreaks } , 28 : { n : "Note" , f : parse _Note } , 29 : { n : "Selection" , f : parse _Selection } , 34 : { n : "Date1904" , f : parse _Date1904 } , 35 : { n : "ExternName" , f : parse _ExternName } , 38 : { n : "LeftMargin" , f : parse _LeftMargin } , 39 : { n : "RightMargin" , f : parse _RightMargin } , 40 : { n : "TopMargin" , f : parse _TopMargin } , 41 : { n : "BottomMargin" , f : parse _BottomMargin } , 42 : { n : "PrintRowCol" , f : parse _PrintRowCol } , 43 : { n : "PrintGrid" , f : parse _PrintGrid } , 47 : { n : "FilePass" , f : parse _FilePass } , 49 : { n : "Font" , f : parse _Font } , 51 : { n : "PrintSize" , f : parse _PrintSize } , 60 : { n : "Continue" , f : parse _Continue } , 61 : { n : "Window1" , f : parse _Window1 } , 64 : { n : "Backup" , f : parse _Backup } , 65 : { n : "Pane" , f : parse _Pane } , 66 : { n : "CodePage" , f : parse _CodePage } , 77 : { n : "Pls" , f : parse _Pls } , 80 : { n : "DCon" , f : parse _DCon } , 81 : { n : "DConRef" , f : parse _DConRef } , 82 : { n : "DConName" , f : parse _DConName } , 85 : { n : "DefColWidth" , f : parse _DefColWidth } , 89 : { n : "XCT" , f : parse _XCT } , 90 : { n : "CRN" , f : parse _CRN } , 91 : { n : "FileSharing" , f : parse _FileSharing } , 92 : { n : "WriteAccess" , f : parse _WriteAccess } , 93 : { n : "Obj" , f : parse _Obj } , 94 : { n : "Uncalced" , f : parse _Uncalced } , 95 : { n : " CalcSaveRe
case "dde-connection-decl" : case "dde-link" : case "dde-source" : break ; case "properties" : break ; case "property" : break ; case "a" : break ; case "table-protection" : break ; case "data-pilot-grand-total" : break ; default : if ( Rn [ 2 ] === "dc:" ) break ; if ( Rn [ 2 ] === "draw:" ) break ; if ( Rn [ 2 ] === "style:" ) break ; if ( Rn [ 2 ] === "calcext:" ) break ; if ( Rn [ 2 ] === "loext:" ) break ; if ( Rn [ 2 ] === "uof:" ) break ; if ( Rn [ 2 ] === "表:" ) break ; if ( Rn [ 2 ] === "字:" ) break ; if ( opts . WTF ) throw new Error ( Rn ) } var out = { Sheets : Sheets , SheetNames : SheetNames } ; return out } } ( ) ; var write _content _xml = function ( ) { var null _cell _xml = " <table:table-cell />\n" ; var covered _cell _xml = " <table:covered-table-cell/>\n" ; var cell _begin = " <table:table-cell " , cell _end = "</table:table-cell>\n" ; var vt = "office:value-type=" ; var p _begin = "<text:p>" , p _end = "</text:p>" ; var write _ws = function ( ws , wb , i , opts ) { var o = [ ] ; o . push ( ' <table:table table:name="' + escapexml ( wb . SheetNames [ i ] ) + '">\n' ) ; var R = 0 , C = 0 , range = decode _range ( ws [ "!ref" ] ) ; var marr = ws [ "!merges" ] || [ ] , mi = 0 ; var dense = Array . isArray ( ws ) ; for ( R = 0 ; R < range . s . r ; ++ R ) o . push ( " <table:table-row></table:table-row>\n" ) ; for ( ; R <= range . e . r ; ++ R ) { o . push ( " <table:table-row>\n" ) ; for ( C = 0 ; C < range . s . c ; ++ C ) o . push ( null _cell _xml ) ; for ( ; C <= range . e . c ; ++ C ) { var skip = false , mxml = "" ; for ( mi = 0 ; mi != marr . length ; ++ mi ) { if ( marr [ mi ] . s . c > C ) continue ; if ( marr [ mi ] . s . r > R ) continue ; if ( marr [ mi ] . e . c < C ) continue ; if ( marr [ mi ] . e . r < R ) continue ; if ( marr [ mi ] . s . c != C || marr [ mi ] . s . r != R ) skip = true ; mxml = 'table:number-columns-spanned="' + ( marr [ mi ] . e . c - marr [ mi ] . s . c + 1 ) + '" table:number-rows-spanned="' + ( marr [ mi ] . e . r - marr [ mi ] . s . r + 1 ) + '" ' ; break } if ( skip ) { o . push ( covered _cell _xml ) ; continue } var ref = encode _cell ( { r : R , c : C } ) , cell = dense ? ( ws [ R ] || [ ] ) [ C ] : ws [ ref ] ; var fmla = "" ; if ( cell && cell . f ) { fmla = ' table:formula="' + escapexml ( csf _to _ods _formula ( cell . f ) ) + '"' ; if ( cell . F ) { if ( cell . F . substr ( 0 , ref . length ) == ref ) { var _Fref = decode _range ( cell . F ) ; fmla += ' table:number-matrix-columns-spanned="' + ( _Fref . e . c - _Fref . s . c + 1 ) + '"' ; fmla += ' table:number-matrix-rows-spanned="' + ( _Fref . e . r - _Fref . s . r + 1 ) + '"' } else fmla = "" } } if ( cell ) switch ( cell . t ) { case "b" : o . push ( cell _begin + mxml + vt + '"boolean" office:boolean-value="' + ( cell . v ? "true" : "false" ) + '"' + fmla + ">" + p _begin + ( cell . v ? "TRUE" : "FALSE" ) + p _end + cell _end ) ; break ; case "n" : o . push ( cell _begin + mxml + vt + '"float" office:value="' + cell . v + '"' + fmla + ">" + p _begin + ( cell . w || cell . v ) + p _end + cell _end ) ; break ; case "s" : case "str" : o . push ( cell _begin + mxml + vt + '"string"' + fmla + ">" + p _begin + escapexml ( cell . v ) + p _end + cell _end ) ; break ; case "d" : o . push ( cell _begin + mxml + vt + '"date" office:date-value="' + parseDate ( cell . v ) . toISOString ( ) + '"' + fmla + ">" + p _begin + ( cell . w || parseDate ( cell . v ) . toISOString ( ) ) + p _end + cell _end ) ; break ; default : o . push ( null _cell _xml ) } else o . push ( null _cell _xml ) } o . push ( " </table:table-row>\n" ) } o . push ( " </table:table>\n" ) ; return o . join ( "" ) } ; return function wcx ( wb , opts ) { var o = [ XML _HEADER ] ; if ( opts . bookType == "fods" ) o . push ( ' < office : document xmlns : office = "urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns : style = "urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns : text = "urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns : table = "urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns : draw = "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns : fo = "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns : xlink = "http://www.w3.org/1999/xlink" xmlns : dc = "http://purl.org/dc/elements/1.1/" xmlns : meta = "urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns : number = "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns : presentation = "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns : svg = "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns : chart = "urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns : dr3d = "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns : math = "http://www.w3.org/1998/Math/MathML" xmlns : form = "urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns : script = "urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns : config = "urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns : ooo = "http://openoffice.org/2004/office" xmlns : ooow = "http://openoffice.org/2004/writer" xmlns : oooc = "http://openoffice.org/2004/calc"