2016-12-31 08:20:45 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-07-28 23:27:16 +00:00
var XLSX = { } ; ( function make _xlsx ( XLSX ) { XLSX . version = "0.10.9" ; var current _codepage = 1200 ; if ( typeof module !== "undefined" && typeof require !== "undefined" ) { if ( typeof cptable === "undefined" ) global . cptable = require ( "./dist/cpexcel.js" ) } 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 } function utf16leread ( data ) { var o = [ ] ; for ( var i = 0 ; i < data . length >> 1 ; ++ i ) o [ i ] = String . fromCharCode ( data . charCodeAt ( 2 * i ) + ( data . charCodeAt ( 2 * i + 1 ) << 8 ) ) ; return o . join ( "" ) } function utf16beread ( data ) { var o = [ ] ; for ( var i = 0 ; i < data . length >> 1 ; ++ i ) o [ i ] = String . fromCharCode ( data . charCodeAt ( 2 * i + 1 ) + ( data . charCodeAt ( 2 * i ) << 8 ) ) ; return o . join ( "" ) } var debom = function ( data ) { var c1 = data . charCodeAt ( 0 ) , c2 = data . charCodeAt ( 1 ) ; if ( c1 == 255 && c2 == 254 ) return utf16leread ( data . substr ( 2 ) ) ; if ( c1 == 254 && c2 == 255 ) return utf16beread ( 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 } ; 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 ) { 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 ) { 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.10.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 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" , " N
} var DO _NOT _EXPORT _CFB = true ; var CFB = function _CFB ( ) { var exports = { } ; exports . version = "0.12.0" ; function parse ( file , options ) { var mver = 3 ; var ssz = 512 ; var nmfs = 0 ; var ndfs = 0 ; var dir _start = 0 ; var minifat _start = 0 ; var difat _start = 0 ; var fat _addrs = [ ] ; var blob = file . slice ( 0 , 512 ) ; prep _blob ( blob , 0 ) ; var mv = check _get _mver ( blob ) ; mver = mv [ 0 ] ; switch ( mver ) { case 3 : ssz = 512 ; break ; case 4 : ssz = 4096 ; break ; default : throw new Error ( "Major Version: Expected 3 or 4 saw " + mver ) ; } if ( ssz !== 512 ) { blob = file . slice ( 0 , ssz ) ; prep _blob ( blob , 28 ) } var header = file . slice ( 0 , ssz ) ; check _shifts ( blob , mver ) ; var nds = blob . read _shift ( 4 , "i" ) ; if ( mver === 3 && nds !== 0 ) throw new Error ( "# Directory Sectors: Expected 0 saw " + nds ) ; blob . l += 4 ; dir _start = blob . read _shift ( 4 , "i" ) ; blob . l += 4 ; blob . chk ( "00100000" , "Mini Stream Cutoff Size: " ) ; minifat _start = blob . read _shift ( 4 , "i" ) ; nmfs = blob . read _shift ( 4 , "i" ) ; difat _start = blob . read _shift ( 4 , "i" ) ; ndfs = blob . read _shift ( 4 , "i" ) ; for ( var q = - 1 , j = 0 ; j < 109 ; ++ j ) { q = blob . read _shift ( 4 , "i" ) ; if ( q < 0 ) break ; fat _addrs [ j ] = q } var sectors = sectorify ( file , ssz ) ; sleuth _fat ( difat _start , ndfs , sectors , ssz , fat _addrs ) ; var sector _list = make _sector _list ( sectors , dir _start , fat _addrs , ssz ) ; sector _list [ dir _start ] . name = "!Directory" ; if ( nmfs > 0 && minifat _start !== ENDOFCHAIN ) sector _list [ minifat _start ] . name = "!MiniFAT" ; sector _list [ fat _addrs [ 0 ] ] . name = "!FAT" ; sector _list . fat _addrs = fat _addrs ; sector _list . ssz = ssz ; var files = { } , Paths = [ ] , FileIndex = [ ] , FullPaths = [ ] , FullPathDir = { } ; read _directory ( dir _start , sector _list , sectors , Paths , nmfs , files , FileIndex ) ; build _full _paths ( FileIndex , FullPathDir , FullPaths , Paths ) ; var root _name = Paths . shift ( ) ; var find _path = make _find _path ( FullPaths , Paths , FileIndex , files , root _name ) ; return { raw : { header : header , sectors : sectors } , FileIndex : FileIndex , FullPaths : FullPaths , FullPathDir : FullPathDir , find : find _path } } function check _get _mver ( blob ) { blob . chk ( HEADER _SIGNATURE , "Header Signature: " ) ; blob . chk ( HEADER _CLSID , "CLSID: " ) ; var mver = blob . read _shift ( 2 , "u" ) ; return [ blob . read _shift ( 2 , "u" ) , mver ] } function check _shifts ( blob , mver ) { var shift = 9 ; blob . l += 2 ; switch ( shift = blob . read _shift ( 2 ) ) { case 9 : if ( mver != 3 ) throw new Error ( "Sector Shift: Expected 9 saw " + shift ) ; break ; case 12 : if ( mver != 4 ) throw new Error ( "Sector Shift: Expected 12 saw " + shift ) ; break ; default : throw new Error ( "Sector Shift: Expected 9 or 12 saw " + shift ) ; } blob . chk ( "0600" , "Mini Sector Shift: " ) ; blob . chk ( "000000000000" , "Reserved: " ) } function sectorify ( file , ssz ) { var nsectors = Math . ceil ( file . length / ssz ) - 1 ; var sectors = [ ] ; 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 = [ ] , q = [ ] ; 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 = [ ] ; var UCPaths = [ ] , i = 0 ; 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 = false ; 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 = ENDOFCHAIN ; 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 ) -
if ( typeof ce !== "string" ) ce = encode _cell ( ce ) ; return cs == ce ? cs : cs + ":" + ce } function safe _decode _range ( range ) { var o = { s : { c : 0 , r : 0 } , e : { c : 0 , r : 0 } } ; var idx = 0 , i = 0 , cc = 0 ; var len = range . length ; for ( idx = 0 ; i < len ; ++ i ) { if ( ( cc = range . charCodeAt ( i ) - 64 ) < 1 || cc > 26 ) break ; idx = 26 * idx + cc } o . s . c = -- idx ; for ( idx = 0 ; i < len ; ++ i ) { if ( ( cc = range . charCodeAt ( i ) - 48 ) < 0 || cc > 9 ) break ; idx = 10 * idx + cc } o . s . r = -- idx ; if ( i === len || range . charCodeAt ( ++ i ) === 58 ) { o . e . c = o . s . c ; o . e . r = o . s . r ; return o } for ( idx = 0 ; i != len ; ++ i ) { if ( ( cc = range . charCodeAt ( i ) - 64 ) < 1 || cc > 26 ) break ; idx = 26 * idx + cc } o . e . c = -- idx ; for ( idx = 0 ; i != len ; ++ i ) { if ( ( cc = range . charCodeAt ( i ) - 48 ) < 0 || cc > 9 ) break ; idx = 10 * idx + cc } o . e . r = -- idx ; return o } function safe _format _cell ( cell , v ) { var q = cell . t == "d" && v instanceof Date ; if ( cell . z != null ) try { return cell . w = SSF . format ( cell . z , q ? datenum ( v ) : v ) } catch ( e ) { } try { return cell . w = SSF . format ( ( cell . XF || { } ) . numFmtId || ( q ? 14 : 0 ) , q ? datenum ( v ) : v ) } catch ( e ) { return "" + v } } function format _cell ( cell , v , o ) { if ( cell == null || cell . t == null || cell . t == "z" ) return "" ; if ( cell . w !== undefined ) return cell . w ; if ( cell . t == "d" && ! cell . z && o && o . dateNF ) cell . z = o . dateNF ; if ( v == undefined ) return safe _format _cell ( cell , cell . v ) ; return safe _format _cell ( cell , v ) } function sheet _to _workbook ( sheet , opts ) { var n = opts && opts . sheet ? opts . sheet : "Sheet1" ; var sheets = { } ; sheets [ n ] = sheet ; return { SheetNames : [ n ] , Sheets : sheets } } function aoa _to _sheet ( data , opts ) { var o = opts || { } ; if ( DENSE != null && o . dense == null ) o . dense = DENSE ; var ws = o . dense ? [ ] : { } ; var range = { s : { c : 1e7 , r : 1e7 } , e : { c : 0 , r : 0 } } ; for ( var R = 0 ; R != data . length ; ++ R ) { for ( var C = 0 ; C != data [ R ] . length ; ++ C ) { if ( typeof data [ R ] [ C ] === "undefined" ) continue ; var cell = { v : data [ R ] [ C ] } ; if ( Array . isArray ( cell . v ) ) { cell . f = data [ R ] [ C ] [ 1 ] ; cell . v = cell . v [ 0 ] } if ( range . s . r > R ) range . s . r = R ; if ( range . s . c > C ) range . s . c = C ; if ( range . e . r < R ) range . e . r = R ; if ( range . e . c < C ) range . e . c = C ; if ( cell . v === null ) { if ( cell . f ) cell . t = "n" ; else if ( ! o . cellStubs ) continue ; else cell . t = "z" } else if ( typeof cell . v === "number" ) cell . t = "n" ; else if ( typeof cell . v === "boolean" ) cell . t = "b" ; else if ( cell . v instanceof Date ) { cell . z = o . dateNF || SSF . _table [ 14 ] ; if ( o . cellDates ) { cell . t = "d" ; cell . w = SSF . format ( cell . z , datenum ( cell . v ) ) } else { cell . t = "n" ; cell . v = datenum ( cell . v ) ; cell . w = SSF . format ( cell . z , cell . v ) } } else cell . t = "s" ; if ( o . dense ) { if ( ! ws [ R ] ) ws [ R ] = [ ] ; ws [ R ] [ C ] = cell } else { var cell _ref = encode _cell ( { c : C , r : R } ) ; ws [ cell _ref ] = cell } } } if ( range . s . c < 1e7 ) ws [ "!ref" ] = encode _range ( range ) ; return ws } function write _UInt32LE ( x , o ) { if ( ! o ) o = new _buf ( 4 ) ; o . write _shift ( 4 , x ) ; return 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 } function parse _StrRun ( data , length ) { return { ich : data . read _shift ( 2 ) , ifnt : data . read _shift ( 2 ) } } function write _StrRun ( run , o ) { if ( ! o ) o = new _buf ( 4 ) ; o . write _shift ( 2 , run . ich || 0 ) ; o . write _shift ( 2 , run . ifnt || 0 ) ; return o } function parse _RichStr ( data , length ) { var start = data . l ; var flags = data . read _shift ( 1 ) ; var str = parse _XLWideString ( data ) ; var rgsStrRun = [ ] ; var z = { t : str , h : str } ; if ( ( flags & 1 ) !== 0 ) { var dwSizeStrRun = data . read _shift ( 4 ) ; for ( var i = 0 ; i != dwSizeStrRun ; ++ i ) rgsStrRun . push ( parse _StrRun ( data ) ) ; z . r = rgsStrRun } else z . r = [ { ich : 0 , ifnt : 0 } ] ; data . l = start + length ; return z } function write _RichStr ( str , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 15 + 4 * str . t . length ) } o . write _shift ( 1 , 0 ) ; write _XLWideString ( str . t , o ) ; return _null ? o . slice ( 0 , o . l ) : o } var parse _BrtCommentText = parse _RichStr ; function write _BrtCommentText ( str , o ) { var _null = false ; if ( o == null ) { _null = true ; o = new _buf ( 23 + 4 * str . t . length ) } o . write _shift ( 1 , 1 ) ; write _XLWideString ( str . t , o ) ; o . write _shift ( 4 , 1 ) ; write _StrRun ( { ich : 0 , ifnt : 0 } , o ) ; return _null ? o . slice ( 0 , o . l ) : o } function parse _XLSBCell ( data ) { 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 ; v
} ) ) } ) ; return "<" + T + ' xmlns="' + XLMLNS . o + '">' + o . join ( "" ) + "</" + T + ">" } function parse _FILETIME ( blob ) { var dwLowDateTime = blob . read _shift ( 4 ) , dwHighDateTime = blob . read _shift ( 4 ) ; return new Date ( ( dwHighDateTime / 1e7 * Math . pow ( 2 , 32 ) + dwLowDateTime / 1e7 - 11644473600 ) * 1e3 ) . toISOString ( ) . replace ( /\.000/ , "" ) } function parse _lpstr ( blob , type , pad ) { var str = blob . read _shift ( 0 , "lpstr" ) ; if ( pad ) blob . l += 4 - ( str . length + 1 & 3 ) & 3 ; return str } function parse _lpwstr ( blob , type , pad ) { var str = blob . read _shift ( 0 , "lpwstr" ) ; if ( pad ) blob . l += 4 - ( str . length + 1 & 3 ) & 3 ; return str } function parse _VtStringBase ( blob , stringType , pad ) { if ( stringType === 31 ) return parse _lpwstr ( blob ) ; return parse _lpstr ( blob , stringType , pad ) } function parse _VtString ( blob , t , pad ) { return parse _VtStringBase ( blob , t , pad === false ? 0 : 4 ) } function parse _VtUnalignedString ( blob , t ) { if ( ! t ) throw new Error ( "dafuq?" ) ; return parse _VtStringBase ( blob , t , 0 ) } function parse _VtVecUnalignedLpstrValue ( blob ) { var length = blob . read _shift ( 4 ) ; var ret = [ ] ; for ( var i = 0 ; i != length ; ++ i ) ret [ i ] = blob . read _shift ( 0 , "lpstr" ) ; return ret } function parse _VtVecUnalignedLpstr ( blob ) { return parse _VtVecUnalignedLpstrValue ( blob ) } function parse _VtHeadingPair ( blob ) { var headingString = parse _TypedPropertyValue ( blob , VT _USTR ) ; var headerParts = parse _TypedPropertyValue ( blob , VT _I4 ) ; return [ headingString , headerParts ] } function parse _VtVecHeadingPairValue ( blob ) { var cElements = blob . read _shift ( 4 ) ; var out = [ ] ; for ( var i = 0 ; i != cElements / 2 ; ++ i ) out . push ( parse _VtHeadingPair ( blob ) ) ; return out } function parse _VtVecHeadingPair ( blob ) { return parse _VtVecHeadingPairValue ( blob ) } function parse _dictionary ( blob , CodePage ) { var cnt = blob . read _shift ( 4 ) ; var dict = { } ; for ( var j = 0 ; j != cnt ; ++ j ) { var pid = blob . read _shift ( 4 ) ; var len = blob . read _shift ( 4 ) ; dict [ pid ] = blob . read _shift ( len , CodePage === 1200 ? "utf16le" : "utf8" ) . replace ( chr0 , "" ) . replace ( chr1 , "!" ) } if ( blob . l & 3 ) blob . l = blob . l >> 2 + 1 << 2 ; return dict } function parse _BLOB ( blob ) { var size = blob . read _shift ( 4 ) ; var bytes = blob . slice ( blob . l , blob . l + size ) ; if ( ( size & 3 ) > 0 ) blob . l += 4 - ( size & 3 ) & 3 ; return bytes } function parse _ClipboardData ( blob ) { var o = { } ; o . Size = blob . read _shift ( 4 ) ; blob . l += o . Size ; return o } function parse _VtVector ( blob , cb ) { } function parse _TypedPropertyValue ( blob , type , _opts ) { var t = blob . read _shift ( 2 ) , ret , opts = _opts || { } ; blob . l += 2 ; if ( type !== VT _VARIANT ) if ( t !== type && VT _CUSTOM . indexOf ( type ) === - 1 ) throw new Error ( "Expected type " + type + " saw " + t ) ; switch ( type === VT _VARIANT ? t : type ) { case 2 : ret = blob . read _shift ( 2 , "i" ) ; if ( ! opts . raw ) blob . l += 2 ; return ret ; case 3 : ret = blob . read _shift ( 4 , "i" ) ; return ret ; case 11 : return blob . read _shift ( 4 ) !== 0 ; case 19 : ret = blob . read _shift ( 4 ) ; return ret ; case 30 : return parse _lpstr ( blob , t , 4 ) . replace ( chr0 , "" ) ; case 31 : return parse _lpwstr ( blob ) ; case 64 : return parse _FILETIME ( blob ) ; case 65 : return parse _BLOB ( blob ) ; case 71 : return parse _ClipboardData ( blob ) ; case 80 : return parse _VtString ( blob , t , ! opts . raw && 4 ) . replace ( chr0 , "" ) ; case 81 : return parse _VtUnalignedString ( blob , t ) . replace ( chr0 , "" ) ; case 4108 : return parse _VtVecHeadingPair ( blob ) ; case 4126 : return parse _VtVecUnalignedLpstr ( blob ) ; default : throw new Error ( "TypedPropertyValue unrecognized type " + type + " " + t ) ; } } function parse _PropertySet ( blob , PIDSI ) { var start _addr = blob . l ; var size = blob . read _shift ( 4 ) ; var NumProps = blob . read _shift ( 4 ) ; var Props = [ ] , i = 0 ; var CodePage = 0 ; var Dictionary = - 1 , DictObj = { } ; for ( i = 0 ; i != NumProps ; ++ i ) { var PropID = blob . read _shift ( 4 ) ; var Offset = blob . read _shift ( 4 ) ; Props [ i ] = [ PropID , Offset + start _addr ] } var PropH = { } ; for ( i = 0 ; i != NumProps ; ++ i ) { if ( blob . l !== Props [ i ] [ 1 ] ) { var fail = true ; if ( i > 0 && PIDSI ) switch ( PIDSI [ Props [ i - 1 ] [ 0 ] ] . t ) { case 2 : if ( blob . l + 2 === Props [ i ] [ 1 ] ) { blob . l += 2 ; fail = false } break ; case 80 : if ( blob . l <= Props [ i ] [ 1 ] ) { blob . l = Props [ i ] [ 1 ] ; fail = false } break ; case 4108 : if ( blob . l <= Props [ i ] [ 1 ] ) { blob . l = Props [ i ] [ 1 ] ; fail = false } break ; } if ( ! PIDSI && blob . l <= Props [ i ] [ 1 ] ) { fail = false ; blob . l = Props [ i ] [ 1 ] } if ( fail ) throw new Error ( "Read Error: Expected address " + Props [ i ] [ 1 ] + " at " + blob . l + " :" + i ) } if ( PIDSI ) { var piddsi = PIDSI [ Props [ i ] [ 0 ] ] ; PropH [ piddsi . n ] = parse _TypedPropertyValue ( blob , piddsi . t , { raw : true } ) ; if ( piddsi . p === "version" ) PropH [ piddsi . n ] = String ( PropH [ piddsi . n ] >> 16 ) + "." + String ( PropH [ piddsi . n ] & 65535 ) ; if ( piddsi . n == "CodePage" ) switch ( PropH [ piddsi . n ] ) { case 0 : PropH [ piddsi . n ]
var parse _ContinueFrt = parsenoop ; var parse _RealTimeData = parsenoop ; var parse _ChartFrtInfo = parsenoop ; var parse _FrtWrapper = parsenoop ; var parse _StartBlock = parsenoop ; var parse _EndBlock = parsenoop ; var parse _StartObject = parsenoop ; var parse _EndObject = parsenoop ; var parse _CatLab = parsenoop ; var parse _YMult = parsenoop ; var parse _SXViewLink = parsenoop ; var parse _PivotChartBits = parsenoop ; var parse _FrtFontList = parsenoop ; var parse _SheetExt = parsenoop ; var parse _BookExt = parsenoop ; var parse _SXAddl = parsenoop ; var parse _CrErr = parsenoop ; var parse _HFPicture = parsenoop ; var parse _Feat = parsenoop ; var parse _DataLabExt = parsenoop ; var parse _DataLabExtContents = parsenoop ; var parse _CellWatch = parsenoop ; var parse _FeatHdr11 = parsenoop ; var parse _Feature11 = parsenoop ; var parse _DropDownObjIds = parsenoop ; var parse _ContinueFrt11 = parsenoop ; var parse _DConn = parsenoop ; var parse _List12 = parsenoop ; var parse _Feature12 = parsenoop ; var parse _CondFmt12 = parsenoop ; var parse _CF12 = parsenoop ; var parse _CFEx = parsenoop ; var parse _AutoFilter12 = parsenoop ; var parse _ContinueFrt12 = parsenoop ; var parse _MDTInfo = parsenoop ; var parse _MDXStr = parsenoop ; var parse _MDXTuple = parsenoop ; var parse _MDXSet = parsenoop ; var parse _MDXProp = parsenoop ; var parse _MDXKPI = parsenoop ; var parse _MDB = parsenoop ; var parse _PLV = parsenoop ; var parse _DXF = parsenoop ; var parse _TableStyles = parsenoop ; var parse _TableStyle = parsenoop ; var parse _TableStyleElement = parsenoop ; var parse _NamePublish = parsenoop ; var parse _SortData = parsenoop ; var parse _GUIDTypeLib = parsenoop ; var parse _FnGrp12 = parsenoop ; var parse _NameFnGrp12 = parsenoop ; var parse _HeaderFooter = parsenoop ; var parse _CrtLayout12 = parsenoop ; var parse _CrtMlFrt = parsenoop ; var parse _CrtMlFrtContinue = parsenoop ; var parse _ShapePropsStream = parsenoop ; var parse _TextPropsStream = parsenoop ; var parse _RichTextStream = parsenoop ; var parse _CrtLayout12A = parsenoop ; var parse _Units = parsenoop ; var parse _Chart = parsenoop ; var parse _Series = parsenoop ; var parse _DataFormat = parsenoop ; var parse _LineFormat = parsenoop ; var parse _MarkerFormat = parsenoop ; var parse _AreaFormat = parsenoop ; var parse _PieFormat = parsenoop ; var parse _AttachedLabel = parsenoop ; var parse _SeriesText = parsenoop ; var parse _ChartFormat = parsenoop ; var parse _Legend = parsenoop ; var parse _SeriesList = parsenoop ; var parse _Bar = parsenoop ; var parse _Line = parsenoop ; var parse _Pie = parsenoop ; var parse _Area = parsenoop ; var parse _Scatter = parsenoop ; var parse _CrtLine = parsenoop ; var parse _Axis = parsenoop ; var parse _Tick = parsenoop ; var parse _ValueRange = parsenoop ; var parse _CatSerRange = parsenoop ; var parse _AxisLine = parsenoop ; var parse _CrtLink = parsenoop ; var parse _DefaultText = parsenoop ; var parse _Text = parsenoop ; var parse _ObjectLink = parsenoop ; var parse _Frame = parsenoop ; var parse _Begin = parsenoop ; var parse _End = parsenoop ; var parse _PlotArea = parsenoop ; var parse _Chart3d = parsenoop ; var parse _PicF = parsenoop ; var parse _DropBar = parsenoop ; var parse _Radar = parsenoop ; var parse _Surf = parsenoop ; var parse _RadarArea = parsenoop ; var parse _AxisParent = parsenoop ; var parse _LegendException = parsenoop ; var parse _SerToCrt = parsenoop ; var parse _AxesUsed = parsenoop ; var parse _SBaseRef = parsenoop ; var parse _SerParent = parsenoop ; var parse _SerAuxTrend = parsenoop ; var parse _IFmtRecord = parsenoop ; var parse _Pos = parsenoop ; var parse _AlRuns = parsenoop ; var parse _BRAI = parsenoop ; var parse _SerAuxErrBar = parsenoop ; var parse _SerFmt = parsenoop ; var parse _Chart3DBarShape = parsenoop ; var parse _Fbi = parsenoop ; var parse _BopPop = parsenoop ; var parse _AxcExt = parsenoop ; var parse _Dat = parsenoop ; var parse _PlotGrowth = parsenoop ; var parse _SIIndex = parsenoop ; var parse _GelFrame = parsenoop ; var parse _BopPopCustom = parsenoop ; var parse _Fbi2 = parsenoop ; function parse _ImData ( blob , length , opts ) { var tgt = blob . l + length ; var cf = blob . read _shift ( 2 ) ; var env = blob . read _shift ( 2 ) ; var lcb = blob . read _shift ( 4 ) ; var o = { fmt : cf , env : env , len : lcb , data : blob . slice ( blob . l , blob . l + lcb ) } ; blob . l += lcb ; return o } function parse _BIFF5String ( blob ) { var len = blob . read _shift ( 1 ) ; return blob . read _shift ( len , "sbcs-cont" ) } function parse _BIFF2STR ( blob , length , opts ) { var cell = parse _XLSCell ( blob , 6 ) ; ++ blob . l ; var str = parse _XLUnicodeString2 ( blob , length - 7 , opts ) ; cell . t = "str" ; cell . val = str ; return cell } function parse _BIFF2NUM ( blob , length , opts ) { var cell = parse _XLSCell ( blob
return o } var write _BrtSSTItem = write _RichStr ; function write _sst _bin ( sst , opts ) { var ba = buf _array ( ) ; write _record ( ba , "BrtBeginSst" , write _BrtBeginSst ( sst ) ) ; for ( var i = 0 ; i < sst . length ; ++ i ) write _record ( ba , "BrtSSTItem" , write _BrtSSTItem ( sst [ i ] ) ) ; write _record ( ba , "BrtEndSst" ) ; return ba . end ( ) } function _JS2ANSI ( str ) { if ( typeof cptable !== "undefined" ) return cptable . utils . encode ( 1252 , str ) ; var o = [ ] , oo = str . split ( "" ) ; for ( var i = 0 ; i < oo . length ; ++ i ) o [ i ] = oo [ i ] . charCodeAt ( 0 ) ; return o } function parse _CRYPTOVersion ( blob , length ) { var o = { } ; o . Major = blob . read _shift ( 2 ) ; o . Minor = blob . read _shift ( 2 ) ; if ( length >= 4 ) blob . l += length - 4 ; return o } function parse _DataSpaceVersionInfo ( blob , length ) { var o = { } ; o . id = blob . read _shift ( 0 , "lpp4" ) ; o . R = parse _CRYPTOVersion ( blob , 4 ) ; o . U = parse _CRYPTOVersion ( blob , 4 ) ; o . W = parse _CRYPTOVersion ( blob , 4 ) ; return o } function parse _DataSpaceMapEntry ( blob ) { var len = blob . read _shift ( 4 ) ; var end = blob . l + len - 4 ; var o = { } ; var cnt = blob . read _shift ( 4 ) ; var comps = [ ] ; while ( cnt -- > 0 ) { var rc = { } ; rc . t = blob . read _shift ( 4 ) ; rc . v = blob . read _shift ( 0 , "lpp4" ) ; comps . push ( rc ) } o . name = blob . read _shift ( 0 , "lpp4" ) ; o . comps = comps ; return o } function parse _DataSpaceMap ( blob , length ) { var o = [ ] ; blob . l += 4 ; var cnt = blob . read _shift ( 4 ) ; while ( cnt -- > 0 ) o . push ( parse _DataSpaceMapEntry ( blob ) ) ; return o } function parse _DataSpaceDefinition ( blob , length ) { var o = [ ] ; blob . l += 4 ; var cnt = blob . read _shift ( 4 ) ; while ( cnt -- > 0 ) o . push ( blob . read _shift ( 0 , "lpp4" ) ) ; return o } function parse _TransformInfoHeader ( blob , length ) { var o = { } ; var len = blob . read _shift ( 4 ) ; var tgt = blob . l + len - 4 ; blob . l += 4 ; o . id = blob . read _shift ( 0 , "lpp4" ) ; o . name = blob . read _shift ( 0 , "lpp4" ) ; o . R = parse _CRYPTOVersion ( blob , 4 ) ; o . U = parse _CRYPTOVersion ( blob , 4 ) ; o . W = parse _CRYPTOVersion ( blob , 4 ) ; return o } function parse _Primary ( blob , length ) { var hdr = parse _TransformInfoHeader ( blob ) ; hdr . ename = blob . read _shift ( 0 , "8lpp4" ) ; hdr . blksz = blob . read _shift ( 4 ) ; hdr . cmode = blob . read _shift ( 4 ) ; if ( blob . read _shift ( 4 ) != 4 ) throw new Error ( "Bad !Primary record" ) ; return hdr } function parse _EncryptionHeader ( blob , length ) { var tgt = blob . l + length ; var o = { } ; o . Flags = blob . read _shift ( 4 ) & 63 ; blob . l += 4 ; o . AlgID = blob . read _shift ( 4 ) ; var valid = false ; switch ( o . AlgID ) { case 26126 : ; case 26127 : ; case 26128 : valid = o . Flags == 36 ; break ; case 26625 : valid = o . Flags == 4 ; break ; case 0 : valid = o . Flags == 16 || o . Flags == 4 || o . Flags == 36 ; break ; default : throw "Unrecognized encryption algorithm: " + o . AlgID ; } if ( ! valid ) throw new Error ( "Encryption Flags/AlgID mismatch" ) ; o . AlgIDHash = blob . read _shift ( 4 ) ; o . KeySize = blob . read _shift ( 4 ) ; o . ProviderType = blob . read _shift ( 4 ) ; blob . l += 8 ; o . CSPName = blob . read _shift ( tgt - blob . l >> 1 , "utf16le" ) . slice ( 0 , - 1 ) ; blob . l = tgt ; return o } function parse _EncryptionVerifier ( blob , length ) { var o = { } ; blob . l += 4 ; o . Salt = blob . slice ( blob . l , blob . l + 16 ) ; blob . l += 16 ; o . Verifier = blob . slice ( blob . l , blob . l + 16 ) ; blob . l += 16 ; var sz = blob . read _shift ( 4 ) ; o . VerifierHash = blob . slice ( blob . l , blob . l + sz ) ; blob . l += sz ; return o } function parse _EncryptionInfo ( blob , length ) { var vers = parse _CRYPTOVersion ( blob ) ; switch ( vers . Minor ) { case 2 : return parse _EncInfoStd ( blob , vers ) ; case 3 : return parse _EncInfoExt ( blob , vers ) ; case 4 : return parse _EncInfoAgl ( blob , vers ) ; } throw new Error ( "ECMA-376 Encryped file unrecognized Version: " + vers . Minor ) } function parse _EncInfoStd ( blob , vers ) { var flags = blob . read _shift ( 4 ) ; if ( ( flags & 63 ) != 36 ) throw new Error ( "EncryptionInfo mismatch" ) ; var sz = blob . read _shift ( 4 ) ; var tgt = blob . l + sz ; var hdr = parse _EncryptionHeader ( blob , sz ) ; var verifier = parse _EncryptionVerifier ( blob , blob . length - blob . l ) ; return { t : "Std" , h : hdr , v : verifier } } function parse _EncInfoExt ( blob , vers ) { throw new Error ( "File is password-protected: ECMA-376 Extensible" ) } function parse _EncInfoAgl ( blob , vers ) { throw new Error ( "File is password-protected: ECMA-376 Agile" ) } function parse _RC4CryptoHeader ( blob , length ) { var o = { } ; var vers = o . EncryptionVersionInfo = parse _CRYPTOVersion ( blob , 4 ) ; length -= 4 ; if ( vers . Minor != 2 ) throw new Error ( "unrecognized minor version code: " + vers . Minor ) ; if ( vers . Major > 4 || vers . Major < 2 ) throw new Error ( "unrecognized major version code: " + vers . Major ) ; o . Flags = blob . read _shift ( 4 ) ; length -= 4 ; var sz = blob . read _shift ( 4 ) ; length -= 4 ; o . EncryptionHeader = parse _EncryptionHeader ( blob , sz ) ; length -= sz ; o . EncryptionVerifier = parse _EncryptionVerifier ( bl
o [ o . length ] = '<a:font script="Khmr" typeface="MoolBoran"/>' ; o [ o . length ] = '<a:font script="Knda" typeface="Tunga"/>' ; o [ o . length ] = '<a:font script="Guru" typeface="Raavi"/>' ; o [ o . length ] = '<a:font script="Cans" typeface="Euphemia"/>' ; o [ o . length ] = '<a:font script="Cher" typeface="Plantagenet Cherokee"/>' ; o [ o . length ] = '<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>' ; o [ o . length ] = '<a:font script="Tibt" typeface="Microsoft Himalaya"/>' ; o [ o . length ] = '<a:font script="Thaa" typeface="MV Boli"/>' ; o [ o . length ] = '<a:font script="Deva" typeface="Mangal"/>' ; o [ o . length ] = '<a:font script="Telu" typeface="Gautami"/>' ; o [ o . length ] = '<a:font script="Taml" typeface="Latha"/>' ; o [ o . length ] = '<a:font script="Syrc" typeface="Estrangelo Edessa"/>' ; o [ o . length ] = '<a:font script="Orya" typeface="Kalinga"/>' ; o [ o . length ] = '<a:font script="Mlym" typeface="Kartika"/>' ; o [ o . length ] = '<a:font script="Laoo" typeface="DokChampa"/>' ; o [ o . length ] = '<a:font script="Sinh" typeface="Iskoola Pota"/>' ; o [ o . length ] = '<a:font script="Mong" typeface="Mongolian Baiti"/>' ; o [ o . length ] = '<a:font script="Viet" typeface="Times New Roman"/>' ; o [ o . length ] = '<a:font script="Uigh" typeface="Microsoft Uighur"/>' ; o [ o . length ] = '<a:font script="Geor" typeface="Sylfaen"/>' ; o [ o . length ] = "</a:majorFont>" ; o [ o . length ] = "<a:minorFont>" ; o [ o . length ] = '<a:latin typeface="Calibri"/>' ; o [ o . length ] = '<a:ea typeface=""/>' ; o [ o . length ] = '<a:cs typeface=""/>' ; o [ o . length ] = '<a:font script="Jpan" typeface="M S Pゴシック"/>' ; o [ o . length ] = '<a:font script="Hang" typeface="맑은 고딕"/>' ; o [ o . length ] = '<a:font script="Hans" typeface="宋体"/>' ; o [ o . length ] = '<a:font script="Hant" typeface="新細明體"/>' ; o [ o . length ] = '<a:font script="Arab" typeface="Arial"/>' ; o [ o . length ] = '<a:font script="Hebr" typeface="Arial"/>' ; o [ o . length ] = '<a:font script="Thai" typeface="Tahoma"/>' ; o [ o . length ] = '<a:font script="Ethi" typeface="Nyala"/>' ; o [ o . length ] = '<a:font script="Beng" typeface="Vrinda"/>' ; o [ o . length ] = '<a:font script="Gujr" typeface="Shruti"/>' ; o [ o . length ] = '<a:font script="Khmr" typeface="DaunPenh"/>' ; o [ o . length ] = '<a:font script="Knda" typeface="Tunga"/>' ; o [ o . length ] = '<a:font script="Guru" typeface="Raavi"/>' ; o [ o . length ] = '<a:font script="Cans" typeface="Euphemia"/>' ; o [ o . length ] = '<a:font script="Cher" typeface="Plantagenet Cherokee"/>' ; o [ o . length ] = '<a:font script="Yiii" typeface="Microsoft Yi Baiti"/>' ; o [ o . length ] = '<a:font script="Tibt" typeface="Microsoft Himalaya"/>' ; o [ o . length ] = '<a:font script="Thaa" typeface="MV Boli"/>' ; o [ o . length ] = '<a:font script="Deva" typeface="Mangal"/>' ; o [ o . length ] = '<a:font script="Telu" typeface="Gautami"/>' ; o [ o . length ] = '<a:font script="Taml" typeface="Latha"/>' ; o [ o . length ] = '<a:font script="Syrc" typeface="Estrangelo Edessa"/>' ; o [ o . length ] = '<a:font script="Orya" typeface="Kalinga"/>' ; o [ o . length ] = '<a:font script="Mlym" typeface="Kartika"/>' ; o [ o . length ] = '<a:font script="Laoo" typeface="DokChampa"/>' ; o [ o . length ] = '<a:font script="Sinh" typeface="Iskoola Pota"/>' ; o [ o . length ] = '<a:font script="Mong" typeface="Mongolian Baiti"/>' ; o [ o . length ] = '<a:font script="Viet" typeface="Arial"/>' ; o [ o . length ] = '<a:font script="Uigh" typeface="Microsoft Uighur"/>' ; o [ o . length ] = '<a:font script="Geor" typeface="Sylfaen"/>' ; o [ o . length ] = "</a:minorFont>" ; o [ o . length ] = "</a:fontScheme>" ; o [ o . length ] = '<a:fmtScheme name="Office">' ; o [ o . length ] = "<a:fillStyleLst>" ; o [ o . length ] = '<a:solidFill><a:schemeClr val="phClr"/></a:solidFill>' ; o [ o . length ] = '<a:gradFill rotWithShape="1">' ; o [ o . length ] = "<a:gsLst>" ; o [ o . length ] = '<a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="50000"/><a:satMod val="300000"/></a:schemeClr></a:gs>' ; o [ o . length ] = '<a:gs pos="35000"><a:schemeClr val="phClr"><a:tint val="37000"/><a:satMod val="300000"/></a:schemeClr></a:gs>' ; o [ o . length ] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="15000"/><a:satMod val="350000"/></a:schemeClr></a:gs>' ; o [ o . length ] = "</a:gsLst>" ; o [ o . length ] = '<a:lin ang="16200000" scaled="1"/>' ; o [ o . length ] = "</a:gradFill>" ; o [ o . length ] = '<a:gradFill rotWithShape="1">' ; o [ o . length ] = "<a:gsLst>" ; o [ o . length ] = ' < a : gs pos = "0" > < a : schemeClr val = "phClr" > < a : tint val = "100000" / > < a : shade val = "100000" / > < a : satMod val = " 130000
if ( opts && opts . biff == 12 ) { rgce [ i ] [ 1 ] [ 1 ] = blob . read _shift ( 4 ) ; o . push ( rgce [ i ] [ 1 ] ) } break ; default : break ; } } length = target - blob . l ; if ( length !== 0 ) o . push ( parsenoop ( blob , length ) ) ; return o } function parse _NameParsedFormula ( blob , length , opts , cce ) { var target = blob . l + length ; var rgce = parse _Rgce ( blob , cce , opts ) ; var rgcb ; if ( target !== blob . l ) rgcb = parse _RgbExtra ( blob , target - blob . l , rgce , opts ) ; return [ rgce , rgcb ] } function parse _XLSCellParsedFormula ( blob , length , opts ) { var target = blob . l + length , len = opts . biff == 2 ? 1 : 2 ; var rgcb , cce = blob . read _shift ( len ) ; if ( cce == 65535 ) return [ [ ] , parsenoop ( blob , length - 2 ) ] ; var rgce = parse _Rgce ( blob , cce , opts ) ; if ( length !== cce + len ) rgcb = parse _RgbExtra ( blob , length - cce - len , rgce , opts ) ; return [ rgce , rgcb ] } function parse _SharedParsedFormula ( blob , length , opts ) { var target = blob . l + length ; var rgcb , cce = blob . read _shift ( 2 ) ; var rgce = parse _Rgce ( blob , cce , opts ) ; if ( cce == 65535 ) return [ [ ] , parsenoop ( blob , length - 2 ) ] ; if ( length !== cce + 2 ) rgcb = parse _RgbExtra ( blob , target - cce - 2 , rgce , opts ) ; return [ rgce , rgcb ] } function parse _ArrayParsedFormula ( blob , length , opts , ref ) { var target = blob . l + length , len = opts . biff == 2 ? 1 : 2 ; var rgcb , cce = blob . read _shift ( len ) ; if ( cce == 65535 ) return [ [ ] , parsenoop ( blob , length - 2 ) ] ; var rgce = parse _Rgce ( blob , cce , opts ) ; if ( length !== cce + len ) rgcb = parse _RgbExtra ( blob , length - cce - len , rgce , opts ) ; return [ rgce , rgcb ] } function parse _Rgce ( blob , length , opts ) { var target = blob . l + length ; var R , id , ptgs = [ ] ; while ( target != blob . l ) { length = target - blob . l ; id = blob [ blob . l ] ; R = PtgTypes [ id ] ; if ( id === 24 || id === 25 ) { id = blob [ blob . l + 1 ] ; R = ( id === 24 ? Ptg18 : Ptg19 ) [ id ] } if ( ! R || ! R . f ) { parsenoop ( blob , length ) } else { ptgs . push ( [ R . n , R . f ( blob , length , opts ) ] ) } } return ptgs } function stringify _array ( f ) { var o = [ ] ; for ( var i = 0 ; i < f . length ; ++ i ) { var x = f [ i ] , r = [ ] ; for ( var j = 0 ; j < x . length ; ++ j ) { var y = x [ j ] ; if ( y ) switch ( y [ 0 ] ) { case 2 : r . push ( '"' + y [ 1 ] . replace ( /"/g , '""' ) + '"' ) ; break ; default : r . push ( y [ 1 ] ) ; } else r . push ( "" ) } o . push ( r . join ( "," ) ) } return o . join ( ";" ) } var PtgBinOp = { PtgAdd : "+" , PtgConcat : "&" , PtgDiv : "/" , PtgEq : "=" , PtgGe : ">=" , PtgGt : ">" , PtgLe : "<=" , PtgLt : "<" , PtgMul : "*" , PtgNe : "<>" , PtgPower : "^" , PtgSub : "-" } ; function get _ixti ( supbooks , ixti , opts ) { return supbooks . SheetNames [ ixti ] } function stringify _formula ( formula , range , cell , supbooks , opts ) { var _range = { s : { c : 0 , r : 0 } , e : { c : 0 , r : 0 } } ; var stack = [ ] , e1 , e2 , type , c , ixti = 0 , nameidx = 0 , r , sname = "" ; if ( ! formula [ 0 ] || ! formula [ 0 ] [ 0 ] ) return "" ; var last _sp = - 1 , sp = "" ; for ( var ff = 0 , fflen = formula [ 0 ] . length ; ff < fflen ; ++ ff ) { var f = formula [ 0 ] [ ff ] ; switch ( f [ 0 ] ) { case "PtgUminus" : stack . push ( "-" + stack . pop ( ) ) ; break ; case "PtgUplus" : stack . push ( "+" + stack . pop ( ) ) ; break ; case "PtgPercent" : stack . push ( stack . pop ( ) + "%" ) ; break ; case "PtgAdd" : ; case "PtgConcat" : ; case "PtgDiv" : ; case "PtgEq" : ; case "PtgGe" : ; case "PtgGt" : ; case "PtgLe" : ; case "PtgLt" : ; case "PtgMul" : ; case "PtgNe" : ; case "PtgPower" : ; case "PtgSub" : e1 = stack . pop ( ) ; e2 = stack . pop ( ) ; if ( last _sp >= 0 ) { switch ( formula [ 0 ] [ last _sp ] [ 1 ] [ 0 ] ) { case 0 : sp = fill ( " " , formula [ 0 ] [ last _sp ] [ 1 ] [ 1 ] ) ; break ; case 1 : sp = fill ( "\r" , formula [ 0 ] [ last _sp ] [ 1 ] [ 1 ] ) ; break ; default : sp = "" ; if ( opts . WTF ) throw new Error ( "Unexpected PtgAttrSpaceType " + formula [ 0 ] [ last _sp ] [ 1 ] [ 0 ] ) ; } e2 = e2 + sp ; last _sp = - 1 } stack . push ( e2 + PtgBinOp [ f [ 0 ] ] + e1 ) ; break ; case "PtgIsect" : e1 = stack . pop ( ) ; e2 = stack . pop ( ) ; stack . push ( e2 + " " + e1 ) ; break ; case "PtgUnion" : e1 = stack . pop ( ) ; e2 = stack . pop ( ) ; stack . push ( e2 + "," + e1 ) ; break ; case "PtgRange" : e1 = stack . pop ( ) ; e2 = stack . pop ( ) ; stack . push ( e2 + ":" + e1 ) ; break ; case "PtgAttrChoose" : break ; case "PtgAttrGoto" : break ; case "PtgAttrIf" : break ; case "PtgAttrIfError" : break ; case "PtgRef" : type = f [ 1 ] [ 0 ] ; c = shift _cell _xls ( f [ 1 ] [ 1 ] , _range , opts ) ; stack . push ( encode _cell _xls ( c ) ) ; break ; case "PtgRefN" : type = f [ 1 ] [ 0 ] ; c = cell ? shift _cell _xls ( f [ 1 ] [ 1 ] , cell , opts ) : f [ 1 ] [ 1 ] ; stack . push ( encode _cell _xls ( c ) ) ; break ; case "PtgRef3d" : type = f [ 1 ] [ 0 ] ; ixti = f [ 1 ] [ 1 ] ; c = shift _cell _xls ( f [ 1 ] [ 2 ] , _range , opts ) ; sname = get _ixti ( supbooks , ixti , opts ) ; var w = sname ; stack . push ( sname + "!" + encode _cell _xls ( c ) ) ; break ; case "PtgFunc" : ; case "PtgFuncVar" : var argc = f [ 1 ] [ 0 ] , func = f [ 1 ] [ 1 ] ; if ( ! argc ) argc = 0 ; var args = argc == 0 ? [ ] : stack . slice ( - argc ) ; stack . length -= argc ; if ( func === "User" ) func = args . shift ( ) ; stack . push ( func + "(" + args . join ( "," ) + ")" ) ; break ; case "PtgBool" : stack . push ( f [ 1 ] ? "TRUE" : "FALSE" ) ; break ; case "PtgInt" : stack . push ( f [ 1 ] ) ; break ; case "PtgNum" : stack . push ( String ( f [ 1 ] ) ) ; brea
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 ( columns . length > 0 ) s [ "!cols" ] = columns ; if ( mergecells . length > 0 ) s [ "!merges" ] = mergecells ; return s } function write _ws _xml _merges ( merges ) { if ( merges . length == 0 ) return "" ; var o = '<mergeCells count="' + merges . length + '">' ; for ( var i = 0 ; i != merges . length ; ++ i ) o += '<mergeCell ref="' + encode _range ( merges [ i ] ) + '"/>' ; return o + "</mergeCells>" } function write _ws _xml _protection ( sp ) { var o = { sheet : 1 } ; var deffalse = [ "objects" , "scenarios" , "selectLockedCells" , "selectUnlockedCells" ] ; var deftrue = [ "formatColumns" , "formatRows" , "formatCells" , "insertColumns" , "insertRows" , "insertHyperlinks" , "deleteColumns" , "deleteRows" , "sort" , "autoFilter" , "pivotTables" ] ; deffalse . forEach ( function ( n ) { if ( sp [ n ] != null && sp [ n ] ) o [ n ] = "1" } ) ; deftrue . forEach ( function ( n ) { if ( sp [ n ] != null && ! sp [ n ] ) o [ n ] = "0" } ) ; if ( sp . password ) o . password = crypto _CreatePasswordVerifier _Method1 ( sp . password ) . toString ( 16 ) . toUpperCase ( ) ; return writextag ( "sheetProtection" , null , o ) } function parse _ws _xml _hlinks ( s , data , rels ) { var dense = Array . isArray ( s ) ; for ( var i = 0 ; i != data . length ; ++ i ) { var val = parsexmltag ( utf8read ( data [ i ] ) , true ) ; if ( ! val . ref ) return ; var rel = rels ? rels [ "!id" ] [ val . id ] : null ; if ( rel ) { val . Target = rel . Target ; if ( val . location ) val . Target += "#" + val . location ; val . Rel = rel } else { val . Target = val . location ; rel = { Target : val . location , TargetMode : "Internal" } ; val . Rel = rel } if ( val . tooltip ) { val . Tooltip = val . tooltip ; delete val . tooltip } var rng = safe _decode _range ( val . ref ) ; for ( var R = rng . s . r ; R <= rng . e . r ; ++ R ) for ( var C = rng . s . c ; C <= rng . e . c ; ++ C ) { var addr = encode _cell ( { c : C , r : R } ) ; if ( dense ) { if ( ! s [ R ] ) s [ R ] = [ ] ; if ( ! s [ R ] [ C ] ) s [ R ] [ C ] = { t : "z" , v : undefined } ; s [ R ] [ C ] . l = val } else { if ( ! s [ addr ] ) s [ addr ] = { t : "z" , v : undefined } ; s [ addr ] . l = val } } } } function parse _ws _xml _margins ( margin ) { var o = { } ; [ "left" , "right" , "top" , "bottom" , "header" , "footer" ] . forEach ( function ( k ) { if ( margin [ k ] ) o [ k ] = parseFloat ( margin [ k ] ) } ) ; return o } function write _ws _xml _margins ( margin ) { default _margins ( margin ) ; return writextag ( "pageMargins" , null , margin ) } function parse _ws _xml _cols ( columns , cols ) { var seencol = false ; for ( var coli = 0 ; coli != cols . length ; ++ coli ) { var coll = parsexmltag ( cols [ coli ] , true ) ; if ( coll . hidden ) coll . hidden = parsexmlbool ( coll . hidden ) ; var colm = parseInt ( coll . min , 10 ) - 1 , colM = parseInt ( coll . max , 10 ) - 1 ; delete coll . min ; delete coll . max ; coll . width = + coll . width ; if ( ! seencol && coll . width ) { seencol = true ; find _mdw _colw ( coll . width ) } process _col ( coll ) ; while ( colm <= colM ) columns [ colm ++ ] = dup ( coll ) } } function write _ws _xml _cols ( ws , cols ) { var o = [ "<cols>" ] , col , width ; for ( var i = 0 ; i != cols . length ; ++ i ) { if ( ! ( col = cols [ i ] ) ) continue ; o [ o . length ] = writextag ( "col" , null , col _obj _w ( i , col ) ) } o [ o . length ] = "</cols>" ; return o . join ( "" ) } function parse _ws _xml _autofilter ( data ) { var o = { ref : ( data . match ( /ref="([^"]*)"/ ) || [ ] ) [ 1 ] } ; return o } function write _ws _xml _autofilter ( data ) { return writextag ( "autoFilter" , null , { ref : data . ref } ) } function write _ws _xml _sheetviews ( ws , opts , idx , wb ) { return writextag ( "sheetViews" , writextag ( "sheetView" , null , { workbookViewId : "0" } ) , { } ) } function write _ws _xml _cell ( cell , ref , ws , opts , idx , wb ) { if ( cell . v === undefined && cell . f === undefined || cell . t === "z" ) return "" ; var vv = "" ; var oldt = cell . t , oldv = cell . v ; switch ( cell . t ) { case "b" : vv = cell . v ? "1" : "0" ; break ; case "n" : vv = "" + cell . v ; break ; case "e" : vv = BErr [ cell . v ] ; break ; case "d" : if ( opts . cellDates ) vv = parseDate ( cell . v , - 1 ) . toISOString ( ) ; else { cell . t = "n" ; vv = "" + ( cell . v = datenum ( parseDate ( cell . v ) ) ) } if ( typeof cell . z === "undefined" ) cell . z = SSF . _table [ 14 ] ; break ; default : vv = cell . v ; break ; } var v = writetag ( "v" , escapexml ( vv ) ) , o = { r : ref } ; var os = get _cell _style ( opts . cellXfs , cell , opts ) ; if ( os !== 0 ) o . s = os ; switch ( cell . t ) { case "n" : break ; case "d" : o . t = "d" ; break ; case "b" : o . t = "b" ; break ; case "e" : o . t = "e" ; break ; default : if ( cell . v == null ) { delete cell . t ; break } if ( opts . bookSST ) { v = writetag ( "v" , "" + get _sst _id ( opts . Strings , cell . v ) ) ; o . t = "s" ; break } o . t = "str" ; break ; } if ( cell . t != oldt ) { cell . t = oldt ; cell . v = oldv } if ( cell . f ) { var ff = cell . F && cell . F . substr ( 0 , ref . length ) == ref ? { t : "array" , ref : cell . F } : null ; v =
function push _defaults _array ( target , defaults ) { for ( var j = 0 ; j != target . length ; ++ j ) { var w = target [ j ] ; for ( var i = 0 ; i != defaults . length ; ++ i ) { var z = defaults [ i ] ; if ( w [ z [ 0 ] ] == null ) w [ z [ 0 ] ] = z [ 1 ] ; else switch ( z [ 2 ] ) { case "bool" : if ( typeof w [ z [ 0 ] ] == "string" ) w [ z [ 0 ] ] = parsexmlbool ( w [ z [ 0 ] ] , z [ 0 ] ) ; break ; case "int" : if ( typeof w [ z [ 0 ] ] == "string" ) w [ z [ 0 ] ] = parseInt ( w [ z [ 0 ] ] , 10 ) ; break ; } } } } function push _defaults ( target , defaults ) { for ( var i = 0 ; i != defaults . length ; ++ i ) { var z = defaults [ i ] ; if ( target [ z [ 0 ] ] == null ) target [ z [ 0 ] ] = z [ 1 ] ; else switch ( z [ 2 ] ) { case "bool" : if ( typeof target [ z [ 0 ] ] == "string" ) target [ z [ 0 ] ] = parsexmlbool ( target [ z [ 0 ] ] , z [ 0 ] ) ; break ; case "int" : if ( typeof target [ z [ 0 ] ] == "string" ) target [ z [ 0 ] ] = parseInt ( target [ z [ 0 ] ] , 10 ) ; break ; } } } function parse _wb _defaults ( wb ) { push _defaults ( wb . WBProps , WBPropsDef ) ; push _defaults ( wb . CalcPr , CalcPrDef ) ; push _defaults _array ( wb . WBView , WBViewDef ) ; push _defaults _array ( wb . Sheets , SheetDef ) ; _ssfopts . date1904 = parsexmlbool ( wb . WBProps . date1904 , "date1904" ) } function safe1904 ( wb ) { if ( ! wb . Workbook ) return "false" ; if ( ! wb . Workbook . WBProps ) return "false" ; return parsexmlbool ( wb . Workbook . WBProps . date1904 ) ? "true" : "false" } var badchars = "][*?/\\" . split ( "" ) ; function check _ws _name ( n , safe ) { if ( n . length > 31 ) { if ( safe ) return false ; throw new Error ( "Sheet names cannot exceed 31 chars" ) } var _good = true ; badchars . forEach ( function ( c ) { if ( n . indexOf ( c ) == - 1 ) return ; if ( ! safe ) throw new Error ( "Sheet name cannot contain : \\ / ? * [ ]" ) ; _good = false } ) ; return _good } function check _wb _names ( N ) { N . forEach ( function ( n , i ) { check _ws _name ( n ) ; for ( var j = 0 ; j < i ; ++ j ) if ( n == N [ j ] ) throw new Error ( "Duplicate Sheet Name: " + n ) } ) } function check _wb ( wb ) { if ( ! wb || ! wb . SheetNames || ! wb . Sheets ) throw new Error ( "Invalid Workbook" ) ; check _wb _names ( wb . SheetNames ) } var wbnsregex = /<\w+:workbook/ ; function parse _wb _xml ( data , opts ) { if ( ! data ) throw new Error ( "Could not find file" ) ; var wb = { AppVersion : { } , WBProps : { } , WBView : [ ] , Sheets : [ ] , CalcPr : { } , Names : [ ] , xmlns : "" } ; var pass = false , xmlns = "xmlns" ; var dname = { } , dnstart = 0 ; data . replace ( tagregex , function xml _wb ( x , idx ) { var y = parsexmltag ( x ) ; switch ( strip _ns ( y [ 0 ] ) ) { case "<?xml" : break ; case "<workbook" : if ( x . match ( wbnsregex ) ) xmlns = "xmlns" + x . match ( /<(\w+):/ ) [ 1 ] ; wb . xmlns = y [ xmlns ] ; break ; case "</workbook>" : break ; case "<fileVersion" : delete y [ 0 ] ; wb . AppVersion = y ; break ; case "<fileVersion/>" : ; case "</fileVersion>" : break ; case "<fileSharing" : ; case "<fileSharing/>" : break ; case "<workbookPr" : ; case "<workbookPr/>" : WBPropsDef . forEach ( function ( w ) { if ( y [ w [ 0 ] ] == null ) return ; switch ( w [ 2 ] ) { case "bool" : wb . WBProps [ w [ 0 ] ] = parsexmlbool ( y [ w [ 0 ] ] , w [ 0 ] ) ; break ; case "int" : wb . WBProps [ w [ 0 ] ] = parseInt ( y [ w [ 0 ] ] , 10 ) ; break ; default : wb . WBProps [ w [ 0 ] ] = y [ w [ 0 ] ] ; } } ) ; break ; case "</workbookPr>" : break ; case "<workbookProtection" : break ; case "<workbookProtection/>" : break ; case "<bookViews" : ; case "<bookViews>" : ; case "</bookViews>" : break ; case "<workbookView" : delete y [ 0 ] ; wb . WBView . push ( y ) ; break ; case "</workbookView>" : break ; case "<sheets" : ; case "<sheets>" : ; case "</sheets>" : break ; case "<sheet" : switch ( y . state ) { case "hidden" : y . Hidden = 1 ; break ; case "veryHidden" : y . Hidden = 2 ; break ; default : y . Hidden = 0 ; } delete y . state ; y . name = unescapexml ( utf8read ( y . name ) ) ; delete y [ 0 ] ; wb . Sheets . push ( y ) ; break ; case "</sheet>" : break ; case "<functionGroups" : ; case "<functionGroups/>" : break ; case "<functionGroup" : break ; case "<externalReferences" : ; case "</externalReferences>" : ; case "<externalReferences>" : break ; case "<externalReference" : break ; case "<definedNames/>" : break ; case "<definedNames>" : ; case "<definedNames" : pass = true ; break ; case "</definedNames>" : pass = false ; break ; case "<definedName" : { dname = { } ; dname . Name = y . name ; if ( y . comment ) dname . Comment = y . comment ; if ( y . localSheetId ) dname . Sheet = + y . localSheetId ; dnstart = idx + x . length } break ; case "</definedName>" : { dname . Ref = data . slice ( dnstart , idx ) ; wb . Names . push ( dname ) } break ; case "<definedName/>" : break ; case "<calcPr" : delete y [ 0 ] ; wb . CalcPr = y ; break ; case "<calcPr/>" : delete y [ 0 ] ; wb . CalcPr = y ; break ; case "</calcPr>" : break ; case "<oleSize" : break ; case "<customWorkbookViews>" : ; case "</customWorkbookViews>" : ; case "<customWorkbookViews" : break ; case "<customWorkbookView" : ; case "</customWorkbookView>" : break ; case "<pivotCaches>" : ; case "</pivotCaches>" : ; case "<pivotCaches" : break ; case "<pivotCache" : break ; case "<smartTagPr" : ; case "<smartTagPr/>" :
break ; case "TrailingMinusNumbers" : break ; case "FormatSettings" : break ; case "FieldType" : break ; case "Delimiters" : break ; case "Tab" : break ; case "Comma" : break ; case "AutoFormatName" : break ; case "VersionLastEdit" : break ; case "VersionLastRefresh" : break ; default : seen = false ; } break ; case "Sorting" : ; case "ConditionalFormatting" : ; case "DataValidation" : switch ( Rn [ 3 ] ) { case "Range" : break ; case "Type" : break ; case "Min" : break ; case "Max" : break ; case "Sort" : break ; case "Descending" : break ; case "Order" : break ; case "CaseSensitive" : break ; case "Value" : break ; case "ErrorStyle" : break ; case "ErrorMessage" : break ; case "ErrorTitle" : break ; case "CellRangeList" : break ; case "InputMessage" : break ; case "InputTitle" : break ; case "ComboHide" : break ; case "InputHide" : break ; case "Condition" : break ; case "Qualifier" : break ; case "UseBlank" : break ; case "Value1" : break ; case "Value2" : break ; case "Format" : break ; default : seen = false ; } break ; case "MapInfo" : ; case "Schema" : ; case "data" : switch ( Rn [ 3 ] ) { case "Map" : break ; case "Entry" : break ; case "Range" : break ; case "XPath" : break ; case "Field" : break ; case "XSDType" : break ; case "FilterOn" : break ; case "Aggregate" : break ; case "ElementType" : break ; case "AttributeType" : break ; case "schema" : ; case "element" : ; case "complexType" : ; case "datatype" : ; case "all" : ; case "attribute" : ; case "extends" : break ; case "row" : break ; default : seen = false ; } break ; case "SmartTags" : break ; default : seen = false ; break ; } if ( seen ) break ; if ( ! state [ state . length - 1 ] [ 1 ] ) throw "Unrecognized tag: " + Rn [ 3 ] + "|" + state . join ( "|" ) ; if ( state [ state . length - 1 ] [ 0 ] === "CustomDocumentProperties" ) { if ( Rn [ 0 ] . slice ( - 2 ) === "/>" ) break ; else if ( Rn [ 1 ] === "/" ) xlml _set _custprop ( Custprops , Rn , cp , str . slice ( pidx , Rn . index ) ) ; else { cp = Rn ; pidx = Rn . index + Rn [ 0 ] . length } break } if ( opts . WTF ) throw "Unrecognized tag: " + Rn [ 3 ] + "|" + state . join ( "|" ) ; } var out = { } ; if ( ! opts . bookSheets && ! opts . bookProps ) out . Sheets = sheets ; out . SheetNames = sheetnames ; out . Workbook = Workbook ; out . SSF = SSF . get _table ( ) ; out . Props = Props ; out . Custprops = Custprops ; return out } function parse _xlml ( data , opts ) { fix _read _opts ( opts = opts || { } ) ; switch ( opts . type || "base64" ) { case "base64" : return parse _xlml _xml ( Base64 . decode ( data ) , opts ) ; case "binary" : ; case "buffer" : ; case "file" : return parse _xlml _xml ( data , opts ) ; case "array" : return parse _xlml _xml ( data . map ( _chr ) . join ( "" ) , opts ) ; } } function write _props _xlml ( wb , opts ) { var o = [ ] ; if ( wb . Props ) o . push ( xlml _write _docprops ( wb . Props , opts ) ) ; if ( wb . Custprops ) o . push ( xlml _write _custprops ( wb . Props , wb . Custprops , opts ) ) ; return o . join ( "" ) } function write _wb _xlml ( wb , opts ) { return "" } function write _sty _xlml ( wb , opts ) { return "" } function write _ws _xlml _wsopts ( ws , opts , idx , wb ) { if ( ! ws ) return "" ; var o = [ ] ; if ( ws [ "!margins" ] ) { o . push ( "<PageSetup>" ) ; if ( ws [ "!margins" ] . header ) o . push ( writextag ( "Header" , null , { "x:Margin" : ws [ "!margins" ] . header } ) ) ; if ( ws [ "!margins" ] . footer ) o . push ( writextag ( "Footer" , null , { "x:Margin" : ws [ "!margins" ] . footer } ) ) ; o . push ( writextag ( "PageMargins" , null , { "x:Bottom" : ws [ "!margins" ] . bottom || "0.75" , "x:Left" : ws [ "!margins" ] . left || "0.7" , "x:Right" : ws [ "!margins" ] . right || "0.7" , "x:Top" : ws [ "!margins" ] . top || "0.75" } ) ) ; o . push ( "</PageSetup>" ) } if ( wb && wb . Workbook && wb . Workbook . Sheets && wb . Workbook . Sheets [ idx ] ) { if ( wb . Workbook . Sheets [ idx ] . Hidden ) o . push ( writextag ( "Visible" , wb . Workbook . Sheets [ idx ] . Hidden == 1 ? "SheetHidden" : "SheetVeryHidden" , { } ) ) ; else { for ( var i = 0 ; i < idx ; ++ i ) if ( wb . Workbook . Sheets [ i ] && ! wb . Workbook . Sheets [ i ] . Hidden ) break ; if ( i == idx ) o . push ( "<Selected/>" ) } } if ( ws [ "!protect" ] ) { o . push ( writetag ( "ProtectContents" , "True" ) ) ; if ( ws [ "!protect" ] . objects ) o . push ( writetag ( "ProtectObjects" , "True" ) ) ; if ( ws [ "!protect" ] . scenarios ) o . push ( writetag ( "ProtectScenarios" , "True" ) ) ; if ( ws [ "!protect" ] . selectLockedCells != null && ! ws [ "!protect" ] . selectLockedCells ) o . push ( writetag ( "EnableSelection" , "NoSelection" ) ) ; else if ( ws [ "!protect" ] . selectUnlockedCells != null && ! ws [ "!protect" ] . selectUnlockedCells ) o . push ( writetag ( "EnableSelection" , "UnlockedCells" ) ) ; [ [ "formatColumns" , "AllowFormatCells" ] , [ "formatRows" , "AllowSizeCols" ] , [ "formatCells" , "AllowSizeRows" ] , [ "insertColumns" , "AllowInsertCols" ] , [ "insertRows" , "AllowInsertRows" ] , [ "insertHyperlinks" , "AllowInsertHyperlinks" ] , [ "deleteColumns" , "AllowDeleteCols" ] , [ "deleteRows" , "AllowDeleteRows" ] , [ "sort" , "AllowSort" ] , [ "autoFilter" , "AllowFilter" ] , [ "pivotTables" , "AllowUsePivotTables" ] ] . for
p : 0 } , 132 : { n : "BrtEndBook" , f : parsenoop } , 133 : { n : "BrtBeginWsViews" , f : parsenoop } , 134 : { n : "BrtEndWsViews" , f : parsenoop } , 135 : { n : "BrtBeginBookViews" , f : parsenoop } , 136 : { n : "BrtEndBookViews" , f : parsenoop } , 137 : { n : "BrtBeginWsView" , f : parsenoop } , 138 : { n : "BrtEndWsView" , f : parsenoop } , 139 : { n : "BrtBeginCsViews" , f : parsenoop } , 140 : { n : "BrtEndCsViews" , f : parsenoop } , 141 : { n : "BrtBeginCsView" , f : parsenoop } , 142 : { n : "BrtEndCsView" , f : parsenoop } , 143 : { n : "BrtBeginBundleShs" , f : parsenoop } , 144 : { n : "BrtEndBundleShs" , f : parsenoop } , 145 : { n : "BrtBeginSheetData" , f : parsenoop } , 146 : { n : "BrtEndSheetData" , f : parsenoop } , 147 : { n : "BrtWsProp" , f : parse _BrtWsProp } , 148 : { n : "BrtWsDim" , f : parse _BrtWsDim , p : 16 } , 151 : { n : "BrtPane" , f : parsenoop } , 152 : { n : "BrtSel" , f : parsenoop } , 153 : { n : "BrtWbProp" , f : parse _BrtWbProp } , 154 : { n : "BrtWbFactoid" , f : parsenoop } , 155 : { n : "BrtFileRecover" , f : parsenoop } , 156 : { n : "BrtBundleSh" , f : parse _BrtBundleSh } , 157 : { n : "BrtCalcProp" , f : parsenoop } , 158 : { n : "BrtBookView" , f : parsenoop } , 159 : { n : "BrtBeginSst" , f : parse _BrtBeginSst } , 160 : { n : "BrtEndSst" , f : parsenoop } , 161 : { n : "BrtBeginAFilter" , f : parse _UncheckedRfX } , 162 : { n : "BrtEndAFilter" , f : parsenoop } , 163 : { n : "BrtBeginFilterColumn" , f : parsenoop } , 164 : { n : "BrtEndFilterColumn" , f : parsenoop } , 165 : { n : "BrtBeginFilters" , f : parsenoop } , 166 : { n : "BrtEndFilters" , f : parsenoop } , 167 : { n : "BrtFilter" , f : parsenoop } , 168 : { n : "BrtColorFilter" , f : parsenoop } , 169 : { n : "BrtIconFilter" , f : parsenoop } , 170 : { n : "BrtTop10Filter" , f : parsenoop } , 171 : { n : "BrtDynamicFilter" , f : parsenoop } , 172 : { n : "BrtBeginCustomFilters" , f : parsenoop } , 173 : { n : "BrtEndCustomFilters" , f : parsenoop } , 174 : { n : "BrtCustomFilter" , f : parsenoop } , 175 : { n : "BrtAFilterDateGroupItem" , f : parsenoop } , 176 : { n : "BrtMergeCell" , f : parse _BrtMergeCell } , 177 : { n : "BrtBeginMergeCells" , f : parsenoop } , 178 : { n : "BrtEndMergeCells" , f : parsenoop } , 179 : { n : "BrtBeginPivotCacheDef" , f : parsenoop } , 180 : { n : "BrtEndPivotCacheDef" , f : parsenoop } , 181 : { n : "BrtBeginPCDFields" , f : parsenoop } , 182 : { n : "BrtEndPCDFields" , f : parsenoop } , 183 : { n : "BrtBeginPCDField" , f : parsenoop } , 184 : { n : "BrtEndPCDField" , f : parsenoop } , 185 : { n : "BrtBeginPCDSource" , f : parsenoop } , 186 : { n : "BrtEndPCDSource" , f : parsenoop } , 187 : { n : "BrtBeginPCDSRange" , f : parsenoop } , 188 : { n : "BrtEndPCDSRange" , f : parsenoop } , 189 : { n : "BrtBeginPCDFAtbl" , f : parsenoop } , 190 : { n : "BrtEndPCDFAtbl" , f : parsenoop } , 191 : { n : "BrtBeginPCDIRun" , f : parsenoop } , 192 : { n : "BrtEndPCDIRun" , f : parsenoop } , 193 : { n : "BrtBeginPivotCacheRecords" , f : parsenoop } , 194 : { n : "BrtEndPivotCacheRecords" , f : parsenoop } , 195 : { n : "BrtBeginPCDHierarchies" , f : parsenoop } , 196 : { n : "BrtEndPCDHierarchies" , f : parsenoop } , 197 : { n : "BrtBeginPCDHierarchy" , f : parsenoop } , 198 : { n : "BrtEndPCDHierarchy" , f : parsenoop } , 199 : { n : "BrtBeginPCDHFieldsUsage" , f : parsenoop } , 200 : { n : "BrtEndPCDHFieldsUsage" , f : parsenoop } , 201 : { n : "BrtBeginExtConnection" , f : parsenoop } , 202 : { n : "BrtEndExtConnection" , f : parsenoop } , 203 : { n : "BrtBeginECDbProps" , f : parsenoop } , 204 : { n : "BrtEndECDbProps" , f : parsenoop } , 205 : { n : "BrtBeginECOlapProps" , f : parsenoop } , 206 : { n : "BrtEndECOlapProps" , f : parsenoop } , 207 : { n : "BrtBeginPCDSConsol" , f : parsenoop } , 208 : { n : "BrtEndPCDSConsol" , f : parsenoop } , 209 : { n : "BrtBeginPCDSCPages" , f : parsenoop } , 210 : { n : "BrtEndPCDSCPages" , f : parsenoop } , 211 : { n : "BrtBeginPCDSCPage" , f : parsenoop } , 212 : { n : "BrtEndPCDSCPage" , f : parsenoop } , 213 : { n : "BrtBeginPCDSCPItem" , f : parsenoop } , 214 : { n : "BrtEndPCDSCPItem" , f : parsenoop } , 215 : { n : "BrtBeginPCDSCSets" , f : parsenoop } , 216 : { n : "BrtEndPCDSCSets" , f : parsenoop } , 217 : { n : "BrtBeginPCDSCSet" , f : parsenoop } , 218 : { n : "BrtEndPCDSCSet" , f : parsenoop } , 219 : { n : "BrtBeginPCDFGroup" , f : parsenoop } , 220 : { n : "BrtEndPCDFGroup" , f : parsenoop } , 221 : { n : "BrtBeginPCDFGItems" , f : parsenoop } , 222 : { n : "BrtEndPCDFGItems" , f : parsenoop } , 223 : { n : "BrtBeginPCDFGRange" , f : parsenoop } , 224 : { n : "BrtEndPCDFGRange" , f : parsenoop } , 225 : { n : "BrtBeginPCDFGDiscrete" , f : parsenoop } , 226 : { n : "BrtEndPCDFGDiscrete" , f : parsenoop } , 227 : { n : "BrtBeginPCDSDTupleCache" , f : parsenoop } , 228 : { n : "BrtEndPCDSDTupleCache" , f : parsenoop } , 229 : { n : "BrtBeginPCDSDTCEntries" , f : parsenoop } , 230 : { n : "BrtEndPCDSDTCEntries" , f : parsenoop } , 231 : { n : "BrtBeginPCDSDTCEMembers" , f : parsenoop } , 232 : { n : "BrtEndPCDSDTCEMembers" , f : parsenoop } , 233 : { n : "BrtBeginPCDSDTCEMember" , f : parsenoop } , 234 : { n : "BrtEndPCDSDTCEMember" , f : parsenoop } , 235 : { n : "BrtBeginPCDSDTCQueries" , f : parsenoop } , 236 : { n : "BrtEndPCDSDTCQueries" , f : parsen
134 : { n : "WriteProtect" , f : parse _WriteProtect } , 140 : { n : "Country" , f : parse _Country } , 141 : { n : "HideObj" , f : parse _HideObj } , 144 : { n : "Sort" , f : parse _Sort } , 146 : { n : "Palette" , f : parse _Palette } , 151 : { n : "Sync" , f : parse _Sync } , 152 : { n : "LPr" , f : parse _LPr } , 153 : { n : "DxGCol" , f : parse _DxGCol } , 154 : { n : "FnGroupName" , f : parse _FnGroupName } , 155 : { n : "FilterMode" , f : parse _FilterMode } , 156 : { n : "BuiltInFnGroupCount" , f : parse _BuiltInFnGroupCount } , 157 : { n : "AutoFilterInfo" , f : parse _AutoFilterInfo } , 158 : { n : "AutoFilter" , f : parse _AutoFilter } , 160 : { n : "Scl" , f : parse _Scl } , 161 : { n : "Setup" , f : parse _Setup } , 174 : { n : "ScenMan" , f : parse _ScenMan } , 175 : { n : "SCENARIO" , f : parse _SCENARIO } , 176 : { n : "SxView" , f : parse _SxView } , 177 : { n : "Sxvd" , f : parse _Sxvd } , 178 : { n : "SXVI" , f : parse _SXVI } , 180 : { n : "SxIvd" , f : parse _SxIvd } , 181 : { n : "SXLI" , f : parse _SXLI } , 182 : { n : "SXPI" , f : parse _SXPI } , 184 : { n : "DocRoute" , f : parse _DocRoute } , 185 : { n : "RecipName" , f : parse _RecipName } , 189 : { n : "MulRk" , f : parse _MulRk } , 190 : { n : "MulBlank" , f : parse _MulBlank } , 193 : { n : "Mms" , f : parse _Mms } , 197 : { n : "SXDI" , f : parse _SXDI } , 198 : { n : "SXDB" , f : parse _SXDB } , 199 : { n : "SXFDB" , f : parse _SXFDB } , 200 : { n : "SXDBB" , f : parse _SXDBB } , 201 : { n : "SXNum" , f : parse _SXNum } , 202 : { n : "SxBool" , f : parse _SxBool } , 203 : { n : "SxErr" , f : parse _SxErr } , 204 : { n : "SXInt" , f : parse _SXInt } , 205 : { n : "SXString" , f : parse _SXString } , 206 : { n : "SXDtr" , f : parse _SXDtr } , 207 : { n : "SxNil" , f : parse _SxNil } , 208 : { n : "SXTbl" , f : parse _SXTbl } , 209 : { n : "SXTBRGIITM" , f : parse _SXTBRGIITM } , 210 : { n : "SxTbpg" , f : parse _SxTbpg } , 211 : { n : "ObProj" , f : parse _ObProj } , 213 : { n : "SXStreamID" , f : parse _SXStreamID } , 215 : { n : "DBCell" , f : parse _DBCell } , 216 : { n : "SXRng" , f : parse _SXRng } , 217 : { n : "SxIsxoper" , f : parse _SxIsxoper } , 218 : { n : "BookBool" , f : parse _BookBool } , 220 : { n : "DbOrParamQry" , f : parse _DbOrParamQry } , 221 : { n : "ScenarioProtect" , f : parse _ScenarioProtect } , 222 : { n : "OleObjectSize" , f : parse _OleObjectSize } , 224 : { n : "XF" , f : parse _XF } , 225 : { n : "InterfaceHdr" , f : parse _InterfaceHdr } , 226 : { n : "InterfaceEnd" , f : parse _InterfaceEnd } , 227 : { n : "SXVS" , f : parse _SXVS } , 229 : { n : "MergeCells" , f : parse _MergeCells } , 233 : { n : "BkHim" , f : parse _BkHim } , 235 : { n : "MsoDrawingGroup" , f : parse _MsoDrawingGroup } , 236 : { n : "MsoDrawing" , f : parse _MsoDrawing } , 237 : { n : "MsoDrawingSelection" , f : parse _MsoDrawingSelection } , 239 : { n : "PhoneticInfo" , f : parse _PhoneticInfo } , 240 : { n : "SxRule" , f : parse _SxRule } , 241 : { n : "SXEx" , f : parse _SXEx } , 242 : { n : "SxFilt" , f : parse _SxFilt } , 244 : { n : "SxDXF" , f : parse _SxDXF } , 245 : { n : "SxItm" , f : parse _SxItm } , 246 : { n : "SxName" , f : parse _SxName } , 247 : { n : "SxSelect" , f : parse _SxSelect } , 248 : { n : "SXPair" , f : parse _SXPair } , 249 : { n : "SxFmla" , f : parse _SxFmla } , 251 : { n : "SxFormat" , f : parse _SxFormat } , 252 : { n : "SST" , f : parse _SST } , 253 : { n : "LabelSst" , f : parse _LabelSst } , 255 : { n : "ExtSST" , f : parse _ExtSST } , 256 : { n : "SXVDEx" , f : parse _SXVDEx } , 259 : { n : "SXFormula" , f : parse _SXFormula } , 290 : { n : "SXDBEx" , f : parse _SXDBEx } , 311 : { n : "RRDInsDel" , f : parse _RRDInsDel } , 312 : { n : "RRDHead" , f : parse _RRDHead } , 315 : { n : "RRDChgCell" , f : parse _RRDChgCell } , 317 : { n : "RRTabId" , f : parse _RRTabId } , 318 : { n : "RRDRenSheet" , f : parse _RRDRenSheet } , 319 : { n : "RRSort" , f : parse _RRSort } , 320 : { n : "RRDMove" , f : parse _RRDMove } , 330 : { n : "RRFormat" , f : parse _RRFormat } , 331 : { n : "RRAutoFmt" , f : parse _RRAutoFmt } , 333 : { n : "RRInsertSh" , f : parse _RRInsertSh } , 334 : { n : "RRDMoveBegin" , f : parse _RRDMoveBegin } , 335 : { n : "RRDMoveEnd" , f : parse _RRDMoveEnd } , 336 : { n : "RRDInsDelBegin" , f : parse _RRDInsDelBegin } , 337 : { n : "RRDInsDelEnd" , f : parse _RRDInsDelEnd } , 338 : { n : "RRDConflict" , f : parse _RRDConflict } , 339 : { n : "RRDDefName" , f : parse _RRDDefName } , 340 : { n : "RRDRstEtxp" , f : parse _RRDRstEtxp } , 351 : { n : "LRng" , f : parse _LRng } , 352 : { n : "UsesELFs" , f : parse _UsesELFs } , 353 : { n : "DSF" , f : parse _DSF } , 401 : { n : "CUsr" , f : parse _CUsr } , 402 : { n : "CbUsr" , f : parse _CbUsr } , 403 : { n : "UsrInfo" , f : parse _UsrInfo } , 404 : { n : "UsrExcl" , f : parse _UsrExcl } , 405 : { n : "FileLock" , f : parse _FileLock } , 406 : { n : "RRDInfo" , f : parse _RRDInfo } , 407 : { n : "BCUsrs" , f : parse _BCUsrs } , 408 : { n : "UsrChk" , f : parse _UsrChk } , 425 : { n : "UserBView" , f : parse _UserBView } , 426 : { n : "UserSViewBegin" , f : parse _UserSViewBegin } , 427 : { n : "UserSViewEnd" , f : parse _UserSViewEnd } , 428 : { n : "RRDUserView" , f : parse _RRDUserView } , 429 : { n : "Qsi" , f : parse _Qsi } , 430 : { n : "SupBook" , f : parse _SupBook } , 431 : { n : "Prot4Rev" , f : parse _Prot4Rev } , 432 : { n : "CondFmt" , f : parse _CondFmt } , 433 : { n : "CF" , f : parse _CF } , 434 : { n : "DVal" , f : parse _DVal } , 437 : { n : "DConBin" , f : parse _DConBin } , 438 : { n : "TxO" , f : parse _TxO } , 439 : { n : " R
o . push ( null _cell _xml ) ; continue } switch ( cell . t ) { case "b" : textp = cell . v ? "TRUE" : "FALSE" ; ct [ "office:value-type" ] = "boolean" ; ct [ "office:boolean-value" ] = cell . v ? "true" : "false" ; break ; case "n" : textp = cell . w || String ( cell . v || 0 ) ; ct [ "office:value-type" ] = "float" ; ct [ "office:value" ] = cell . v || 0 ; break ; case "s" : ; case "str" : textp = escapexml ( cell . v ) ; ct [ "office:value-type" ] = "string" ; break ; case "d" : textp = cell . w || parseDate ( cell . v ) . toISOString ( ) ; ct [ "office:value-type" ] = "date" ; ct [ "office:date-value" ] = parseDate ( cell . v ) . toISOString ( ) ; ct [ "table:style-name" ] = "ce1" ; break ; default : o . push ( null _cell _xml ) ; continue ; } o . push ( " " + writextag ( "table:table-cell" , writextag ( "text:p" , textp , { } ) , ct ) + "\n" ) } o . push ( " </table:table-row>\n" ) } o . push ( " </table:table>\n" ) ; return o . join ( "" ) } ; var write _automatic _styles _ods = function ( o ) { o . push ( " <office:automatic-styles>\n" ) ; o . push ( ' <number:date-style style:name="N37" number:automatic-order="true">\n' ) ; o . push ( ' <number:month number:style="long"/>\n' ) ; o . push ( " <number:text>/</number:text>\n" ) ; o . push ( ' <number:day number:style="long"/>\n' ) ; o . push ( " <number:text>/</number:text>\n" ) ; o . push ( " <number:year/>\n" ) ; o . push ( " </number:date-style>\n" ) ; o . push ( ' <style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N37"/>\n' ) ; o . push ( " </office:automatic-styles>\n" ) } ; return function wcx ( wb , opts ) { var o = [ XML _HEADER ] ; var attr = wxt _helper ( { "xmlns:office" : "urn:oasis:names:tc:opendocument:xmlns:office:1.0" , "xmlns:table" : "urn:oasis:names:tc:opendocument:xmlns:table: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: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:ooo" : "http://openoffice.org/2004/office" , "xmlns:ooow" : "http://openoffice.org/2004/writer" , "xmlns:oooc" : "http://openoffice.org/2004/calc" , "xmlns:dom" : "http://www.w3.org/2001/xml-events" , "xmlns:xforms" : "http://www.w3.org/2002/xforms" , "xmlns:xsd" : "http://www.w3.org/2001/XMLSchema" , "xmlns:xsi" : "http://www.w3.org/2001/XMLSchema-instance" , "xmlns:sheet" : "urn:oasis:names:tc:opendocument:sh33tjs:1.0" , "xmlns:rpt" : "http://openoffice.org/2005/report" , "xmlns:of" : "urn:oasis:names:tc:opendocument:xmlns:of:1.2" , "xmlns:xhtml" : "http://www.w3.org/1999/xhtml" , "xmlns:grddl" : "http://www.w3.org/2003/g/data-view#" , "xmlns:tableooo" : "http://openoffice.org/2009/table" , "xmlns:drawooo" : "http://openoffice.org/2010/draw" , "xmlns:calcext" : "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" , "xmlns:loext" : "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" , "xmlns:field" : "urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" , "xmlns:formx" : "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" , "xmlns:css3t" : "http://www.w3.org/TR/css3-text/" , "office:version" : "1.2" } ) ; var fods = wxt _helper ( { "xmlns:config" : "urn:oasis:names:tc:opendocument:xmlns:config:1.0" , "office:mimetype" : "application/vnd.oasis.opendocument.spreadsheet" } ) ; if ( opts . bookType == "fods" ) o . push ( "<office:document" + attr + fods + ">\n" ) ; else o . push ( "<office:document-content" + attr + ">\n" ) ; write _automatic _styles _ods ( o ) ; o . push ( " <office:body>\n" ) ; o . push ( " <office:spreadsheet>\n" ) ; for ( var i = 0 ; i != wb . SheetNames . length ; ++ i ) o . push ( write _ws ( wb . Sheets [ wb . SheetNames [ i ] ] , wb , i , opts ) ) ; o . push ( " < / o f f i c e : s p r e a d s h