2016-12-31 08:20:45 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-04-03 06:02:02 +00:00
var XLSX = { } ; ( function make _xlsx ( XLSX ) { XLSX . version = "0.9.9" ; 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 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"秒 "' , 65535 : "General" } ; var
} 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 . push ( o ) } } function read _date ( blob , off
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 : "Comments" , t : VT _STRING } , 7 : { n : "Template" , t : VT _STRING } , 8 : { n : "LastAuthor" , t : VT _STRING } , 9 : { n : "RevNumber" , t : VT _STRING } , 10 : { n : "EditTime" , t : VT _FILETIME } , 11 : { n : "LastPrinted" , t : VT _FILETIME } , 12 : { n : "CreatedDate" , t : VT _FILETIME } , 13 : { n : "ModifiedDate" , t : VT _FILETIME } , 14 : { n : "PageCount" , t : VT _I4 } , 15 : { n : "WordCount" , t : VT _I4 } , 16 : { n : "CharCount" , t : VT _I4 } , 17 : { n : "Thumbnail" , t : VT _CF } , 18 : { n : "ApplicationName" , t : VT _LPSTR } , 19 : { n : "DocumentSecurity" , t : VT _I4 } , 255 : { } } ; var SpecialProperties = { 2147483648 : { n : "Locale" , t : VT _UI4 } , 2147483651 : { n : "Behavior" , t : VT _UI4 } , 1919054434 : { } } ; ( function ( ) { for ( var y in SpecialProperties ) if ( SpecialProperties . hasOwnProperty ( y ) ) DocSummaryPIDDSI [ y ] = SummaryPIDSI [ y ] = SpecialProperties [ y ] } ) ( ) ; var CountryEnum = { 1 : "US" , 2 : "CA" , 3 : "" , 7 : "RU" , 20 : "EG" , 30 : "GR" , 31 : "NL" , 32 : "BE" , 33 : "FR" , 34 : "ES" , 36 : "HU" , 39 : "IT" , 41 : "CH" , 43 : "AT" , 44 : "GB" , 45 : "DK" , 46 : "SE" , 47 : "NO" , 48 : "PL" , 49 : "DE" , 52 : "MX" , 55 : "BR" , 61 : "AU" , 64 : "NZ" , 66 : "TH" , 81 : "JP" , 82 : "KR" , 84 : "VN" , 86 : "CN" , 90 : "TR" , 105 : "JS" , 213 : "DZ" , 216 : "MA" , 218 : "LY" , 351 : "PT" , 354 : "IS" , 358 : "FI" , 420 : "CZ" , 886 : "TW" , 961 : "LB" , 962 : "JO" , 963 : "SY" , 964 : "IQ" , 965 : "KW" , 966 : "SA" , 971 : "AE" , 972 : "IL" , 974 : "QA" , 981 : "IR" , 65535 : "US" } ; var XLSFillPattern = [ null , "solid" , "mediumGray" , "darkGray" , "lightGray" , "darkHorizontal" , "darkVertical" , "darkDown" , "darkUp" , "darkGrid" , "darkTrellis" , "lightHorizontal" , "lightVertical" , "lightDown" , "lightUp" , "lightGrid" , "lightTrellis" , "gray125" , "gray0625" ] ; function rgbify ( arr ) { return arr . map ( function ( x ) { return [ x >> 16 & 255 , x >> 8 & 255 , x & 255 ] } ) } var XLSIcv = rgbify ( [ 0 , 16777215 , 16711680 , 65280 , 255 , 16776960 , 16711935 , 65535 , 0 , 16777215 , 16711680 , 65280 , 255 , 16776960 , 16711935 , 65535 , 8388608 , 32768 , 128 , 8421376 , 8388736 , 32896 , 12632256 , 8421504 , 10066431 , 10040166 , 16777164 , 13434879 , 6684774 , 16744576 , 26316 , 13421823 , 128 , 16711935 , 16776960 , 65535 , 8388736 , 8388608 , 32896 , 255 , 52479 , 13434879 , 13434828 , 16777113 , 10079487 , 16751052 , 13408767 , 16764057 , 3368703 , 3394764 , 10079232 , 16763904 , 16750848 , 16737792 , 6710937 , 9868950 , 13158 , 3381606 , 13056 , 3355392 , 10040064 , 10040166 , 3355545 , 3355443 , 16777215 , 0 ] ) ; var ct2type = { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" : "workbooks" , "application/vnd.ms-excel.binIndexWs" : "TODO" , "application/vnd.ms-excel.intlmacrosheet" : "TODO" , "application/vnd.ms-excel.binIndexMs" : "TODO" , "application/vnd.openxmlformats-package.core-properties+xml" : "coreprops" , "application/vnd.openxmlformats-officedocument.custom-properties+xml" : "custprops" , "application/vnd.openxmlformats-officedocument.extended-properties+xml" : "extprops" , "application/vnd.openxmlformats-officedocument.customXmlProperties+xml" : "TODO" , "application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty" : "TODO" , "application/vnd.ms-excel.pivotTable" : "TODO" , "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml" : "TODO" , "application/vnd.ms-office.chartcolorstyle+xml" : "TODO" , "application/vnd.ms-office.chartstyle+xml" : "TODO" , "application/vnd.ms-excel.calcChain" : "calcchains" , "application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml" : "calcchains" , "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings" : "TODO" , "application/vnd.ms-office.activeX" : "TODO" , "application/vnd.ms-office.activeX+xml" : "TODO" , "application/vnd.ms-excel.attachedToolbars" : "TODO" , "application/vnd.ms-excel.connections" : "TODO" , "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml" : "TODO" , "application/vnd.ms-excel.externalLink" : "TODO" , "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml" : "TODO" , "application/vnd.ms-excel.sheetMetadata" : "TODO" , "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml" : "TODO" , "application/vnd.ms-excel.pivotCacheDefinition" : "TODO" , "application/vnd.ms-excel.pivotCacheRecords" : "TODO" , " application / vnd . openxmlformats - officedocument . spreadsheetml . pivotCac
default : throw new Error ( "Unsupported Moniker " + clsid ) } } ; var parse _HyperlinkString = function ( blob , length ) { var len = blob . read _shift ( 4 ) ; var o = blob . read _shift ( len , "utf16le" ) . replace ( chr0 , "" ) ; return o } ; var parse _Hyperlink = function ( blob , length ) { var end = blob . l + length ; var sVer = blob . read _shift ( 4 ) ; if ( sVer !== 2 ) throw new Error ( "Unrecognized streamVersion: " + sVer ) ; var flags = blob . read _shift ( 2 ) ; blob . l += 2 ; var displayName , targetFrameName , moniker , oleMoniker , location , guid , fileTime ; if ( flags & 16 ) displayName = parse _HyperlinkString ( blob , end - blob . l ) ; if ( flags & 128 ) targetFrameName = parse _HyperlinkString ( blob , end - blob . l ) ; if ( ( flags & 257 ) === 257 ) moniker = parse _HyperlinkString ( blob , end - blob . l ) ; if ( ( flags & 257 ) === 1 ) oleMoniker = parse _HyperlinkMoniker ( blob , end - blob . l ) ; if ( flags & 8 ) location = parse _HyperlinkString ( blob , end - blob . l ) ; if ( flags & 32 ) guid = blob . read _shift ( 16 ) ; if ( flags & 64 ) fileTime = parse _FILETIME ( blob , 8 ) ; blob . l = end ; var target = targetFrameName || moniker || oleMoniker ; if ( location ) target += "#" + location ; return { Target : target } } ; function parse _LongRGBA ( blob , length ) { var r = blob . read _shift ( 1 ) , g = blob . read _shift ( 1 ) , b = blob . read _shift ( 1 ) , a = blob . read _shift ( 1 ) ; return [ r , g , b , a ] } function parse _LongRGB ( blob , length ) { var x = parse _LongRGBA ( blob , length ) ; x [ 3 ] = 0 ; return x } function parse _XLSCell ( blob , length ) { var rw = blob . read _shift ( 2 ) ; var col = blob . read _shift ( 2 ) ; var ixfe = blob . read _shift ( 2 ) ; return { r : rw , c : col , ixfe : ixfe } } function parse _frtHeader ( blob ) { var rt = blob . read _shift ( 2 ) ; var flags = blob . read _shift ( 2 ) ; blob . l += 8 ; return { type : rt , flags : flags } } function parse _OptXLUnicodeString ( blob , length , opts ) { return length === 0 ? "" : parse _XLUnicodeString2 ( blob , length , opts ) } var HIDEOBJENUM = [ "SHOWALL" , "SHOWPLACEHOLDER" , "HIDEALL" ] ; var parse _HideObjEnum = parseuint16 ; function parse _XTI ( blob , length ) { var iSupBook = blob . read _shift ( 2 ) , itabFirst = blob . read _shift ( 2 , "i" ) , itabLast = blob . read _shift ( 2 , "i" ) ; return [ iSupBook , itabFirst , itabLast ] } function parse _RkRec ( blob , length ) { var ixfe = blob . read _shift ( 2 ) ; var RK = parse _RkNumber ( blob ) ; return [ ixfe , RK ] } function parse _AddinUdf ( blob , length , opts ) { blob . l += 4 ; length -= 4 ; var l = blob . l + length ; var udfName = parse _ShortXLUnicodeString ( blob , length , opts ) ; var cb = blob . read _shift ( 2 ) ; l -= blob . l ; if ( cb !== l ) throw new Error ( "Malformed AddinUdf: padding = " + l + " != " + cb ) ; blob . l += cb ; return udfName } function parse _Ref8U ( blob , length ) { var rwFirst = blob . read _shift ( 2 ) ; var rwLast = blob . read _shift ( 2 ) ; var colFirst = blob . read _shift ( 2 ) ; var colLast = blob . read _shift ( 2 ) ; return { s : { c : colFirst , r : rwFirst } , e : { c : colLast , r : rwLast } } } function parse _RefU ( blob , length ) { var rwFirst = blob . read _shift ( 2 ) ; var rwLast = blob . read _shift ( 2 ) ; var colFirst = blob . read _shift ( 1 ) ; var colLast = blob . read _shift ( 1 ) ; return { s : { c : colFirst , r : rwFirst } , e : { c : colLast , r : rwLast } } } var parse _Ref = parse _RefU ; function parse _FtCmo ( blob , length ) { blob . l += 4 ; var ot = blob . read _shift ( 2 ) ; var id = blob . read _shift ( 2 ) ; var flags = blob . read _shift ( 2 ) ; blob . l += 12 ; return [ id , ot , flags ] } function parse _FtNts ( blob , length ) { var out = { } ; blob . l += 4 ; blob . l += 16 ; out . fSharedNote = blob . read _shift ( 2 ) ; blob . l += 4 ; return out } function parse _FtCf ( blob , length ) { var out = { } ; blob . l += 4 ; blob . cf = blob . read _shift ( 2 ) ; return out } var FtTab = { 21 : parse _FtCmo , 19 : parsenoop , 18 : function ( blob , length ) { blob . l += 12 } , 17 : function ( blob , length ) { blob . l += 8 } , 16 : parsenoop , 15 : parsenoop , 13 : parse _FtNts , 12 : function ( blob , length ) { blob . l += 24 } , 11 : function ( blob , length ) { blob . l += 10 } , 10 : function ( blob , length ) { blob . l += 16 } , 9 : parsenoop , 8 : function ( blob , length ) { blob . l += 6 } , 7 : parse _FtCf , 6 : function ( blob , length ) { blob . l += 6 } , 4 : parsenoop , 0 : function ( blob , length ) { blob . l += 4 } } ; function parse _FtArray ( blob , length , ot ) { var s = blob . l ; var fts = [ ] ; while ( blob . l < s + length ) { var ft = blob . read _shift ( 2 ) ; blob . l -= 2 ; try { fts . push ( FtTab [ ft ] ( blob , s + length - blob . l ) ) } catch ( e ) { blob . l = s + length ; return fts } } if ( blob . l != s + length ) blob . l = s + length ; return fts } var parse _FontIndex = parseuint16 ; function parse _BOF ( blob , length ) { var o = { BIFFVer : 0 , dt : 0 } ; o . BIFFVer = blob . read _shift ( 2 ) ; length -= 2 ; if ( length >= 2 ) { o . dt = blob . read _shift ( 2 ) ; blob . l -= 2 } switch ( o . BIFFVer ) { case 1536 : case 1280 : case 2 : case 7 : break ; default : if ( length > 6 ) throw new Error ( "Unexpected BIFF Ver " + o . BIFFVer ) } blob . read _shift ( length ) ; return o } function parse _InterfaceHdr ( blob , length ) { if ( l
} var sheet _to _dif = function ( ) { var push _field = function pf ( o , topic , v , n , s ) { o . push ( topic ) ; o . push ( v + "," + n ) ; o . push ( '"' + s . replace ( /"/g , '""' ) + '"' ) } ; var push _value = function po ( o , type , v , s ) { o . push ( type + "," + v ) ; o . push ( type == 1 ? '"' + s . replace ( /"/g , '""' ) + '"' : s ) } ; return function sheet _to _dif ( ws , opts ) { var o = [ ] ; var r = decode _range ( ws [ "!ref" ] ) , cell ; push _field ( o , "TABLE" , 0 , 1 , "sheetjs" ) ; push _field ( o , "VECTORS" , 0 , r . e . r - r . s . r + 1 , "" ) ; push _field ( o , "TUPLES" , 0 , r . e . c - r . s . c + 1 , "" ) ; push _field ( o , "DATA" , 0 , 0 , "" ) ; for ( var R = r . s . r ; R <= r . e . r ; ++ R ) { push _value ( o , - 1 , 0 , "BOT" ) ; for ( var C = r . s . c ; C <= r . e . c ; ++ C ) { var coord = encode _cell ( { r : R , c : C } ) ; if ( ! ( cell = ws [ coord ] ) || cell . v == null ) { push _value ( o , 1 , 0 , "" ) ; continue } switch ( cell . t ) { case "n" : push _value ( o , 0 , cell . v , "V" ) ; break ; case "b" : push _value ( o , 0 , cell . v ? 1 : 0 , cell . v ? "TRUE" : "FALSE" ) ; break ; case "s" : push _value ( o , 1 , 0 , cell . v ) ; break ; default : push _value ( o , 1 , 0 , "" ) } } } push _value ( o , - 1 , 0 , "EOD" ) ; var RS = "\r\n" ; var oo = o . join ( RS ) ; return oo } } ( ) ; return { to _workbook : dif _to _workbook , to _sheet : dif _to _sheet , from _sheet : sheet _to _dif } } ( ) ; var PRN = function ( ) { function set _text _arr ( data , arr , R , C ) { if ( data === "TRUE" ) arr [ R ] [ C ] = true ; else if ( data === "FALSE" ) arr [ R ] [ C ] = false ; else if ( data === "" ) { } else if ( + data == + data ) arr [ R ] [ C ] = + data ; else arr [ R ] [ C ] = data } function prn _to _aoa _str ( f , opts ) { var arr = [ ] ; if ( ! f || f . length === 0 ) return arr ; var lines = f . split ( /[\r\n]/ ) ; var L = lines . length - 1 ; while ( L >= 0 && lines [ L ] . length === 0 ) -- L ; var start = 10 , idx = 0 ; var R = 0 ; for ( ; R <= L ; ++ R ) { idx = lines [ R ] . indexOf ( " " ) ; if ( idx == - 1 ) idx = lines [ R ] . length ; else idx ++ ; start = Math . max ( start , idx ) } for ( R = 0 ; R <= L ; ++ R ) { arr [ R ] = [ ] ; var C = 0 ; set _text _arr ( lines [ R ] . slice ( 0 , start ) . trim ( ) , arr , R , C ) ; for ( C = 1 ; C <= ( lines [ R ] . length - start ) / 10 + 1 ; ++ C ) set _text _arr ( lines [ R ] . slice ( start + ( C - 1 ) * 10 , start + C * 10 ) . trim ( ) , arr , R , C ) } return arr } function dsv _to _sheet _str ( str , opts ) { var sep = "" ; var ws = { } ; var range = { s : { c : 0 , r : 0 } , e : { c : 0 , r : 0 } } ; if ( str . substr ( 0 , 4 ) == "sep=" && str . charCodeAt ( 5 ) == 10 ) { sep = str . charAt ( 4 ) ; str = str . substr ( 6 ) } if ( str . substr ( 0 , 1024 ) . indexOf ( "\t" ) == - 1 ) sep = "," ; else sep = "\t" ; var R = 0 , C = 0 , v = 0 ; var start = 0 , end = 0 , sepcc = sep . charCodeAt ( 0 ) , instr = false , cc = 0 ; for ( ; end < str . length ; ++ end ) switch ( cc = str . charCodeAt ( end ) ) { case 34 : instr = ! instr ; break ; case sepcc : case 10 : if ( instr ) break ; var s = str . slice ( start , end ) ; var cell = { } ; if ( s . charCodeAt ( 0 ) == 61 ) { cell . t = "n" ; cell . f = s . substr ( 1 ) } else if ( s == "TRUE" ) { cell . t = "b" ; cell . v = true } else if ( s == "FALSE" ) { cell . t = "b" ; cell . v = false } else if ( ! isNaN ( v = parseFloat ( s ) ) ) { cell . t = "n" ; cell . w = s ; cell . v = v } else { cell . t = "s" ; cell . v = s . replace ( /^"/ , "" ) . replace ( /"$/ , "" ) . replace ( /""/g , '"' ) } ws [ encode _cell ( { c : C , r : R } ) ] = cell ; start = end + 1 ; if ( range . e . c < C ) range . e . c = C ; if ( range . e . r < R ) range . e . r = R ; if ( cc == sepcc ) ++ C ; else { C = 0 ; ++ R } ; break ; default : break } ws [ "!ref" ] = encode _range ( range ) ; return ws } function prn _to _sheet _str ( str , opts ) { if ( str . substr ( 0 , 4 ) == "sep=" ) return dsv _to _sheet _str ( str , opts ) ; if ( str . indexOf ( "\t" ) >= 0 || str . indexOf ( "," ) >= 0 ) return dsv _to _sheet _str ( str , opts ) ; return aoa _to _sheet ( prn _to _aoa _str ( str , opts ) , opts ) } function prn _to _sheet ( d , opts ) { switch ( opts . type ) { case "base64" : return prn _to _sheet _str ( Base64 . decode ( d ) , opts ) ; case "binary" : return prn _to _sheet _str ( d , opts ) ; case "buffer" : return prn _to _sheet _str ( d . toString ( "binary" ) , opts ) ; case "array" : return prn _to _sheet _str ( cc2str ( d ) , opts ) } throw new Error ( "Unrecognized type " + opts . type ) } function prn _to _workbook ( str , opts ) { return sheet _to _workbook ( prn _to _sheet ( str , opts ) , opts ) } function sheet _to _prn ( ws , opts ) { var o = [ ] ; var r = decode _range ( ws [ "!ref" ] ) , cell ; for ( var R = r . s . r ; R <= r . e . r ; ++ R ) { var oo = [ ] ; for ( var C = r . s . c ; C <= r . e . c ; ++ C ) { var coord = encode _cell ( { r : R , c : C } ) ; if ( ! ( cell = ws [ coord ] ) || cell . v == null ) { oo . push ( " " ) ; continue } var w = ( cell . w || ( format _cell ( cell ) , cell . w ) || "" ) . substr ( 0 , 10 ) ; while ( w . length < 10 ) w += " " ; oo . push ( w + ( C == 0 ? " " : "" ) ) } o . push ( oo . join ( "" ) ) } return o . join ( "\n" ) } return { to _workbook : prn _to _workbook , to _sheet : prn _to _sheet , from _sheet : sheet _to _prn } } ( ) ; var CS2CP = { 0 : 1252 , 1 : 65001 , 2 : 65001 , 77 : 1e4 , 128 : 932 , 129 : 949 , 130 : 1361 , 134 : 936 , 136 : 950 , 161 : 1253 , 162 : 1254 , 163 : 1258 , 177 : 1255 , 178 : 1256 , 186 : 1257 , 204 : 1251 , 222 : 874 , 238 : 1250 , 255 : 1252 , 69 : 6969 } ; var parse _rs = function parse _rs _factory ( ) { var tregex = matchtag ( "t" ) , rpregex = matchtag ( "rPr" ) , rregex = /<(?:\w+:)?r>/g , rend = /<\/(?:\w+:)?r>/ , nlr
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"/></a:schemeClr></a:gs>' ; o [ o . length ] = '<a:gs pos="100000"><a:schemeClr val="phClr"><a:tint val="50000"/><a:shade val="100000"/><a:satMod val="350000"/></a:schemeClr></a:gs>' ; o [ o . length ] = "</a:gsLst>" ; o [ o . length ] = '<a:lin ang="16200000" scaled="0"/>' ; o [ o . length ] = "</a:gradFill>" ; o [ o . length ] = "</a:fillStyleLst>" ; o [ o . length ] = "<a:lnStyleLst>" ; o [ o . length ] = '<a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"><a:shade val="95000"/><a:satMod val="105000"/></a:schemeClr></a:solidFill><a:prstDash val="solid"/></a:ln>' ; o [ o . length ] = '<a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/></a:ln>' ; o [ o . length ] = ' < a : ln w = "38100" cap = "flat" cmpd = "sng" algn = "ctr" > < a : solidFill > < a : schemeClr v
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 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 = shift _cell _xls ( f [ 1 ] [ 1 ] , cell , opts ) ; 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 = supbooks && supbooks [ 1 ] ? supbooks [ 1 ] [ ixti + 1 ] : "**MISSING**" ; stack . push ( sname + "!" + encode _cell ( 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 ] ) ) ; break ; case "PtgStr" : stack . push ( '"' + f [ 1 ] + '"' ) ; break ; case "PtgErr" : stack . push ( f [ 1 ] ) ; break ; case "PtgAreaN" : type = f [ 1 ] [ 0 ] ; r = shift _range _xls ( f [ 1 ] [ 1 ] , _range , opts ) ; stack . push ( encode _range _xls ( r , opts ) ) ; break ; case "PtgArea" : type = f [ 1 ] [ 0 ] ; r = shift _range _xls ( f [ 1 ] [ 1 ] , _range , opts ) ; stack . push ( encode _range _xls ( r , opts ) ) ; break ; case "PtgArea3d" : type = f [ 1 ] [ 0 ] ; ixti = f [ 1 ] [ 1 ] ; r = f [ 1 ] [ 2 ] ; sname = supbooks && supbooks [ 1 ] ? supbooks [ 1 ] [ ixti + 1 ] : "**MISSING**" ; stack . push ( sname + "!" + encode _range ( r ) ) ; break ; case "PtgAttrSum" : stack . push ( "SUM(" + stack . pop ( ) + ")" ) ; break ; case "PtgAttrSemi" : break ; case "PtgName" : nameidx = f [ 1 ] [ 2 ] ; var lbl = supbooks [ 0 ] [ nameidx ] ; var name = lbl ? lbl . Name : "**MISSING**" + String ( nameidx ) ; if ( name in XLSXFutureFunctions ) name = XLSXFutureFunctions [ name ] ; stack . push ( name ) ; break ; case "PtgNameX" : var bookidx = f [ 1 ] [ 1 ] ; nameidx = f [ 1 ] [ 2 ] ; var externbook ; if ( opts . biff == 5 ) { if ( bookidx < 0 ) bookidx = - bookidx ; if ( supbooks [ bookidx ] ) externbook = supbooks [ bookidx ] [ nameidx ] } else { if ( supbooks [ bookidx + 1 ] ) externbook = supbooks [ bookidx + 1 ] [ nameidx ] ; else if ( supbooks [ bookidx - 1 ] ) externbook = supbooks [ bookidx - 1 ] [ nameidx ] } if ( ! externbook ) externbook = { body : "??NAMEX??" } ; stack . push ( externbook . body ) ; break ; case "PtgParen" : var lp = "(" , rp = ")" ; if ( last _sp >= 0 ) { sp = "" ; switch ( formula [ 0 ] [ last _sp ] [ 1 ] [ 0 ] ) { case 2 : lp = fill ( " " , formula [ 0 ] [ last _sp ] [ 1 ] [ 1 ] ) + lp ; break ; case 3 : lp = fill ( "\r" , formula [ 0 ] [ last _sp ] [ 1 ] [ 1 ] ) + lp ; break ; case 4 : rp = fill ( " " , formula [ 0
var refregex = /ref=["']([^"']*)["']/ ; var match _v = matchtag ( "v" ) , match _f = matchtag ( "f" ) ; return function parse _ws _xml _data ( sdata , s , opts , guess , themes , styles ) { var ri = 0 , x = "" , cells = [ ] , cref = [ ] , idx = 0 , i = 0 , cc = 0 , d = "" , p ; var tag , tagr = 0 , tagc = 0 ; var sstr , ftag ; var fmtid = 0 , fillid = 0 , do _format = Array . isArray ( styles . CellXf ) , cf ; var arrayf = [ ] ; var sharedf = [ ] ; for ( var marr = sdata . split ( rowregex ) , mt = 0 , marrlen = marr . length ; mt != marrlen ; ++ mt ) { x = marr [ mt ] . trim ( ) ; var xlen = x . length ; if ( xlen === 0 ) continue ; for ( ri = 0 ; ri < xlen ; ++ ri ) if ( x . charCodeAt ( ri ) === 62 ) break ; ++ ri ; tag = parsexmltag ( x . substr ( 0 , ri ) , true ) ; tagr = typeof tag . r !== "undefined" ? parseInt ( tag . r , 10 ) : tagr + 1 ; tagc = - 1 ; if ( opts . sheetRows && opts . sheetRows < tagr ) continue ; if ( guess . s . r > tagr - 1 ) guess . s . r = tagr - 1 ; if ( guess . e . r < tagr - 1 ) guess . e . r = tagr - 1 ; cells = x . substr ( ri ) . split ( cellregex ) ; for ( ri = 0 ; ri != cells . length ; ++ ri ) { x = cells [ ri ] . trim ( ) ; if ( x . length === 0 ) continue ; cref = x . match ( rregex ) ; idx = ri ; i = 0 ; cc = 0 ; x = "<c " + ( x . substr ( 0 , 1 ) == "<" ? ">" : "" ) + x ; if ( cref != null && cref . length === 2 ) { idx = 0 ; d = cref [ 1 ] ; for ( i = 0 ; i != d . length ; ++ i ) { if ( ( cc = d . charCodeAt ( i ) - 64 ) < 1 || cc > 26 ) break ; idx = 26 * idx + cc } -- idx ; tagc = idx } else ++ tagc ; for ( i = 0 ; i != x . length ; ++ i ) if ( x . charCodeAt ( i ) === 62 ) break ; ++ i ; tag = parsexmltag ( x . substr ( 0 , i ) , true ) ; if ( ! tag . r ) tag . r = utils . encode _cell ( { r : tagr - 1 , c : tagc } ) ; d = x . substr ( i ) ; p = { t : "" } ; if ( ( cref = d . match ( match _v ) ) != null && cref [ 1 ] !== "" ) p . v = unescapexml ( cref [ 1 ] ) ; if ( opts . cellFormula ) { if ( ( cref = d . match ( match _f ) ) != null && cref [ 1 ] !== "" ) { p . f = unescapexml ( utf8read ( cref [ 1 ] ) ) . replace ( /_xlfn\./ , "" ) ; if ( cref [ 0 ] . indexOf ( 't="array"' ) > - 1 ) { p . F = ( d . match ( refregex ) || [ ] ) [ 1 ] ; if ( p . F . indexOf ( ":" ) > - 1 ) arrayf . push ( [ safe _decode _range ( p . F ) , p . F ] ) } else if ( cref [ 0 ] . indexOf ( 't="shared"' ) > - 1 ) { ftag = parsexmltag ( cref [ 0 ] ) ; sharedf [ parseInt ( ftag . si , 10 ) ] = [ ftag , unescapexml ( utf8read ( cref [ 1 ] ) ) ] } } else if ( cref = d . match ( /<f[^>]*\/>/ ) ) { ftag = parsexmltag ( cref [ 0 ] ) ; if ( sharedf [ ftag . si ] ) p . f = shift _formula _xlsx ( sharedf [ ftag . si ] [ 1 ] , sharedf [ ftag . si ] [ 0 ] . ref , tag . r ) } var _tag = decode _cell ( tag . r ) ; for ( i = 0 ; i < arrayf . length ; ++ i ) if ( _tag . r >= arrayf [ i ] [ 0 ] . s . r && _tag . r <= arrayf [ i ] [ 0 ] . e . r ) if ( _tag . c >= arrayf [ i ] [ 0 ] . s . c && _tag . c <= arrayf [ i ] [ 0 ] . e . c ) p . F = arrayf [ i ] [ 1 ] } if ( tag . t === undefined && p . v === undefined ) { if ( ! opts . sheetStubs ) continue ; p . t = "z" } else p . t = tag . t || "n" ; if ( guess . s . c > idx ) guess . s . c = idx ; if ( guess . e . c < idx ) guess . e . c = idx ; switch ( p . t ) { case "n" : p . v = parseFloat ( p . v ) ; break ; case "s" : sstr = strs [ parseInt ( p . v , 10 ) ] ; if ( typeof p . v == "undefined" ) { if ( ! opts . sheetStubs ) continue ; p . t = "z" } p . v = sstr . t ; p . r = sstr . r ; if ( opts . cellHTML ) p . h = sstr . h ; break ; case "str" : p . t = "s" ; p . v = p . v != null ? utf8read ( p . v ) : "" ; if ( opts . cellHTML ) p . h = p . v ; break ; case "inlineStr" : cref = d . match ( isregex ) ; p . t = "s" ; if ( cref != null && ( sstr = parse _si ( cref [ 1 ] ) ) ) p . v = sstr . t ; else p . v = "" ; break ; case "b" : p . v = parsexmlbool ( p . v ) ; break ; case "d" : if ( ! opts . cellDates ) { p . v = datenum ( parseDate ( p . v ) ) ; p . t = "n" } break ; case "e" : p . w = p . v ; p . v = RBErr [ p . v ] ; break } fmtid = fillid = 0 ; if ( do _format && tag . s !== undefined ) { cf = styles . CellXf [ tag . s ] ; if ( cf != null ) { if ( cf . numFmtId != null ) fmtid = cf . numFmtId ; if ( opts . cellStyles && cf . fillId != null ) fillid = cf . fillId } } safe _format ( p , fmtid , fillid , opts , themes , styles ) ; if ( opts . cellDates && do _format && p . t == "n" && SSF . is _date ( SSF . _table [ fmtid ] ) ) { var _d = SSF . parse _date _code ( p . v ) ; 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 ) ) } } s [ tag . r ] = p } } } } ( ) ; function write _ws _xml _data ( ws , opts , idx , wb , rels ) { var o = [ ] , r = [ ] , range = safe _decode _range ( ws [ "!ref" ] ) , cell , ref , rr = "" , cols = [ ] , R = 0 , C = 0 , rows = ws [ "!rows" ] ; for ( C = range . s . c ; C <= range . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; for ( R = range . s . r ; R <= range . e . r ; ++ R ) { r = [ ] ; rr = encode _row ( R ) ; for ( C = range . s . c ; C <= range . e . c ; ++ C ) { ref = cols [ C ] + rr ; if ( ws [ ref ] === undefined ) continue ; if ( ( cell = write _ws _xml _cell ( ws [ ref ] , ref , ws , opts , idx , wb ) ) != null ) r . push ( cell ) } if ( r . length > 0 ) { var params = { r : rr } ; if ( rows && rows [ R ] ) { var row = rows [ R ] ; if ( row . hidden ) params . hidden = 1 ; var height = - 1 ; if ( row . hpx ) height = px2pt ( row . hpx ) ; else if ( row . hpt ) height = row . hpt ; if ( height > - 1 ) { params . ht = height ; params . customHeight = 1 } } o [ o . length ] = writextag ( "row" , r . join ( "" ) , params ) } } return o . join ( "" ) } var WS _XML _ROOT = writextag ( "worksheet" , null , { xmlns : XMLNS . main [ 0 ] , "xmlns:r" : XMLNS . r } ) ; function write _ws _xml ( idx , opts , wb , rels ) { var o = [ XML _HEADER , WS _XML _ROOT ] ; var s = wb . SheetNames [ idx ] , sidx = 0 , rdata = "" ; va
var d = { Hidden : viz , iTabID : idx + 1 , strRelID : "rId" + ( idx + 1 ) , name : wb . SheetNames [ idx ] } ; write _record ( ba , "BrtBundleSh" , write _BrtBundleSh ( d ) ) } write _record ( ba , "BrtEndBundleShs" ) } function write _BrtFileVersion ( data , o ) { if ( ! o ) o = new _buf ( 127 ) ; for ( var i = 0 ; i != 4 ; ++ i ) o . write _shift ( 4 , 0 ) ; write _XLWideString ( "SheetJS" , o ) ; write _XLWideString ( XLSX . version , o ) ; write _XLWideString ( XLSX . version , o ) ; write _XLWideString ( "7262" , o ) ; o . length = o . l ; return o . length > o . l ? o . slice ( 0 , o . l ) : o } function write _BrtBookView ( idx , o ) { if ( ! o ) o = new _buf ( 29 ) ; o . write _shift ( - 4 , 0 ) ; o . write _shift ( - 4 , 460 ) ; o . write _shift ( 4 , 28800 ) ; o . write _shift ( 4 , 17600 ) ; o . write _shift ( 4 , 500 ) ; o . write _shift ( 4 , idx ) ; o . write _shift ( 4 , idx ) ; var flags = 120 ; o . write _shift ( 1 , flags ) ; return o . length > o . l ? o . slice ( 0 , o . l ) : o } function write _BOOKVIEWS ( ba , wb , opts ) { if ( ! wb . Workbook || ! wb . Workbook . Sheets ) return ; var sheets = wb . Workbook . Sheets ; var i = 0 , vistab = - 1 , hidden = - 1 ; for ( ; i < sheets . length ; ++ i ) { if ( ! sheets [ i ] || ! sheets [ i ] . Hidden && vistab == - 1 ) vistab = i ; else if ( sheets [ i ] . Hidden == 1 && hidden == - 1 ) hidden = i } if ( hidden > vistab ) return ; write _record ( ba , "BrtBeginBookViews" ) ; write _record ( ba , "BrtBookView" , write _BrtBookView ( vistab ) ) ; write _record ( ba , "BrtEndBookViews" ) } function write _BrtCalcProp ( data , o ) { if ( ! o ) o = new _buf ( 26 ) ; o . write _shift ( 4 , 0 ) ; o . write _shift ( 4 , 1 ) ; o . write _shift ( 4 , 0 ) ; write _Xnum ( 0 , o ) ; o . write _shift ( - 4 , 1023 ) ; o . write _shift ( 1 , 51 ) ; o . write _shift ( 1 , 0 ) ; return o } function write _BrtFileRecover ( data , o ) { if ( ! o ) o = new _buf ( 1 ) ; o . write _shift ( 1 , 0 ) ; return o } function write _wb _bin ( wb , opts ) { var ba = buf _array ( ) ; write _record ( ba , "BrtBeginBook" ) ; write _record ( ba , "BrtFileVersion" , write _BrtFileVersion ( ) ) ; write _record ( ba , "BrtWbProp" , write _BrtWbProp ( ) ) ; write _BOOKVIEWS ( ba , wb , opts ) ; write _BUNDLESHS ( ba , wb , opts ) ; write _record ( ba , "BrtEndBook" ) ; return ba . end ( ) } function parse _wb ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _wb _bin ( data , opts ) ; return parse _wb _xml ( data , opts ) } function parse _ws ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _ws _bin ( data , opts , rels , wb , themes , styles ) ; return parse _ws _xml ( data , opts , rels , wb , themes , styles ) } function parse _cs ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _cs _bin ( data , opts , rels , wb , themes , styles ) ; return parse _cs _xml ( data , opts , rels , wb , themes , styles ) } function parse _ms ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _ms _bin ( data , opts , rels , wb , themes , styles ) ; return parse _ms _xml ( data , opts , rels , wb , themes , styles ) } function parse _ds ( data , name , opts , rels , wb , themes , styles ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _ds _bin ( data , opts , rels , wb , themes , styles ) ; return parse _ds _xml ( data , opts , rels , wb , themes , styles ) } function parse _sty ( data , name , themes , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _sty _bin ( data , themes , opts ) ; return parse _sty _xml ( data , themes , opts ) } function parse _theme ( data , name , opts ) { return parse _theme _xml ( data , opts ) } function parse _sst ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _sst _bin ( data , opts ) ; return parse _sst _xml ( data , opts ) } function parse _cmnt ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _comments _bin ( data , opts ) ; return parse _comments _xml ( data , opts ) } function parse _cc ( data , name , opts ) { if ( name . slice ( - 4 ) === ".bin" ) return parse _cc _bin ( data , opts ) ; return parse _cc _xml ( data , opts ) } function write _wb ( wb , name , opts ) { return ( name . slice ( - 4 ) === ".bin" ? write _wb _bin : write _wb _xml ) ( wb , opts ) } function write _ws ( data , name , opts , wb , rels ) { return ( name . slice ( - 4 ) === ".bin" ? write _ws _bin : write _ws _xml ) ( data , opts , wb , rels ) } function write _sty ( data , name , opts ) { return ( name . slice ( - 4 ) === ".bin" ? write _sty _bin : write _sty _xml ) ( data , opts ) } function write _sst ( data , name , opts ) { return ( name . slice ( - 4 ) === ".bin" ? write _sst _bin : write _sst _xml ) ( data , opts ) } function write _cmnt ( data , name , opts ) { return ( name . slice ( - 4 ) === ".bin" ? write _comments _bin : write _comments _xml ) ( data , opts ) } var attregexg2 = /([\w:]+)=((?:")([^"]*)(?:")|(?:')([^']*)(?:'))/g ; var attregex2 = /([\w:]+)=((?:")(?:[^"]*)(?:")|(?:')(?:[^']*)(?:'))/ ; var _chr = function ( c ) { return String . fromCharCode ( c ) } ; function xlml _parsexmltag ( tag , skip _root ) { var words = tag . split ( /\s+/ ) ; var z = [ ] ; if ( ! skip _root ) z [ 0 ] = words [ 0 ] ; if ( words . length === 1 ) return z ; var m = tag . match ( attregexg2 ) , y
wb . opts . CalcPrecision = val ; break ; case "CalcSaveRecalc" : wb . opts . CalcSaveRecalc = val ; break ; case "CalcRefMode" : opts . CalcRefMode = val ; break ; case "Uncalced" : break ; case "ForceFullCalculation" : wb . opts . FullCalc = val ; break ; case "WsBool" : break ; case "XF" : XFs . push ( val ) ; break ; case "ExtSST" : break ; case "BookExt" : break ; case "RichTextStream" : break ; case "BkHim" : break ; case "SupBook" : supbooks [ ++ sbc ] = [ val ] ; sbci = 0 ; break ; case "ExternName" : supbooks [ sbc ] [ ++ sbci ] = val ; break ; case "Index" : break ; case "Lbl" : supbooks [ 0 ] [ ++ sbcli ] = val ; break ; case "ExternSheet" : supbooks [ sbc ] = supbooks [ sbc ] . concat ( val ) ; sbci += val . length ; break ; case "Protect" : out [ "!protect" ] = val ; break ; case "Password" : if ( val !== 0 && opts . WTF ) console . error ( "Password verifier: " + val ) ; break ; case "Prot4Rev" : case "Prot4RevPass" : break ; case "BoundSheet8" : { Directory [ val . pos ] = val ; opts . snames . push ( val . name ) } break ; case "EOF" : { if ( -- file _depth ) break ; if ( range . e ) { if ( range . e . r > 0 && range . e . c > 0 ) { range . e . r -- ; range . e . c -- ; out [ "!ref" ] = encode _range ( range ) ; range . e . r ++ ; range . e . c ++ } if ( mergecells . length > 0 ) out [ "!merges" ] = mergecells ; if ( objects . length > 0 ) out [ "!objects" ] = objects ; if ( colinfo . length > 0 ) out [ "!cols" ] = colinfo ; if ( rowinfo . length > 0 ) out [ "!rows" ] = rowinfo ; Workbook . Sheets . push ( wsprops ) } if ( cur _sheet === "" ) Preamble = out ; else Sheets [ cur _sheet ] = out ; out = { } } break ; case "BOF" : { if ( opts . biff !== 8 ) { } else if ( RecordType === 9 ) opts . biff = 2 ; else if ( RecordType === 521 ) opts . biff = 3 ; else if ( RecordType === 1033 ) opts . biff = 4 ; else if ( val . BIFFVer === 1280 ) opts . biff = 5 ; else if ( val . BIFFVer === 1536 ) opts . biff = 8 ; else if ( val . BIFFVer === 2 ) opts . biff = 2 ; else if ( val . BIFFVer === 7 ) opts . biff = 2 ; if ( file _depth ++ ) break ; cell _valid = true ; out = { } ; if ( opts . biff < 5 ) { if ( cur _sheet === "" ) cur _sheet = "Sheet1" ; range = { s : { r : 0 , c : 0 } , e : { r : 0 , c : 0 } } ; var fakebs8 = { pos : blob . l - length , name : cur _sheet } ; Directory [ fakebs8 . pos ] = fakebs8 ; opts . snames . push ( cur _sheet ) } else cur _sheet = ( Directory [ s ] || { name : "" } ) . name ; if ( val . dt == 32 ) out [ "!type" ] = "chart" ; mergecells = [ ] ; objects = [ ] ; array _formulae = [ ] ; opts . arrayf = array _formulae ; colinfo = [ ] ; rowinfo = [ ] ; defwidth = defheight = 0 ; seencol = false ; wsprops = { Hidden : ( Directory [ s ] || { hs : 0 } ) . hs , name : cur _sheet } } break ; case "Number" : case "BIFF2NUM" : case "BIFF2INT" : { if ( out [ "!type" ] == "chart" && out [ encode _cell ( { c : val . c , r : val . r } ) ] ) ++ val . c ; temp _val = { ixfe : val . ixfe , XF : XFs [ val . ixfe ] , v : val . val , t : "n" } ; safe _format _xf ( temp _val , options , wb . opts . Date1904 ) ; addcell ( { c : val . c , r : val . r } , temp _val , options ) } break ; case "BoolErr" : { temp _val = { ixfe : val . ixfe , XF : XFs [ val . ixfe ] , v : val . val , t : val . t } ; safe _format _xf ( temp _val , options , wb . opts . Date1904 ) ; addcell ( { c : val . c , r : val . r } , temp _val , options ) } break ; case "RK" : { temp _val = { ixfe : val . ixfe , XF : XFs [ val . ixfe ] , v : val . rknum , t : "n" } ; safe _format _xf ( temp _val , options , wb . opts . Date1904 ) ; addcell ( { c : val . c , r : val . r } , temp _val , options ) } break ; case "MulRk" : { for ( var j = val . c ; j <= val . C ; ++ j ) { var ixfe = val . rkrec [ j - val . c ] [ 0 ] ; temp _val = { ixfe : ixfe , XF : XFs [ ixfe ] , v : val . rkrec [ j - val . c ] [ 1 ] , t : "n" } ; safe _format _xf ( temp _val , options , wb . opts . Date1904 ) ; addcell ( { c : j , r : val . r } , temp _val , options ) } } break ; case "Formula" : { if ( val . val == "String" ) { last _formula = val ; break } temp _val = { v : val . val , ixfe : val . cell . ixfe , t : val . tt } ; temp _val . XF = XFs [ temp _val . ixfe ] ; if ( options . cellFormula ) { var _f = val . formula ; if ( _f && _f [ 0 ] && _f [ 0 ] [ 0 ] && _f [ 0 ] [ 0 ] [ 0 ] == "PtgExp" ) { var _fr = _f [ 0 ] [ 0 ] [ 1 ] [ 0 ] , _fc = _f [ 0 ] [ 0 ] [ 1 ] [ 1 ] ; var _fe = encode _cell ( { r : _fr , c : _fc } ) ; if ( shared _formulae [ _fe ] ) temp _val . f = "" + stringify _formula ( val . formula , range , val . cell , supbooks , opts ) ; else temp _val . F = ( out [ _fe ] || { } ) . F } else temp _val . f = "" + stringify _formula ( val . formula , range , val . cell , supbooks , opts ) } safe _format _xf ( temp _val , options , wb . opts . Date1904 ) ; addcell ( val . cell , temp _val , options ) ; last _formula = val } break ; case "String" : { if ( last _formula ) { last _formula . val = val ; temp _val = { v : val , ixfe : last _formula . cell . ixfe , t : "s" } ; temp _val . XF = XFs [ temp _val . ixfe ] ; if ( options . cellFormula ) { temp _val . f = "" + stringify _formula ( last _formula . formula , range , last _formula . cell , supbooks , opts ) } safe _format _xf ( temp _val , options , wb . opts . Date1904 ) ; addcell ( last _formula . cell , temp _val , options ) ; last _formula = null } else throw new Error ( "String record expects Formula" ) } break ; case "Array" : { array _formulae . push ( val ) ; var _arraystart = encode _cell ( val [ 0 ] . s ) ; if ( options . cellFormula && out [ _arraystart ] ) { if ( ! last _formula ) break ; if ( ! _arraysta
f : parsenoop } , 593 : { n : "BrtEndCellSmartTags" , f : parsenoop } , 594 : { n : "BrtBeginSmartTags" , f : parsenoop } , 595 : { n : "BrtEndSmartTags" , f : parsenoop } , 596 : { n : "BrtSmartTagType" , f : parsenoop } , 597 : { n : "BrtBeginSmartTagTypes" , f : parsenoop } , 598 : { n : "BrtEndSmartTagTypes" , f : parsenoop } , 599 : { n : "BrtBeginSXFilters" , f : parsenoop } , 600 : { n : "BrtEndSXFilters" , f : parsenoop } , 601 : { n : "BrtBeginSXFILTER" , f : parsenoop } , 602 : { n : "BrtEndSXFilter" , f : parsenoop } , 603 : { n : "BrtBeginFills" , f : parsenoop } , 604 : { n : "BrtEndFills" , f : parsenoop } , 605 : { n : "BrtBeginCellWatches" , f : parsenoop } , 606 : { n : "BrtEndCellWatches" , f : parsenoop } , 607 : { n : "BrtCellWatch" , f : parsenoop } , 608 : { n : "BrtBeginCRErrs" , f : parsenoop } , 609 : { n : "BrtEndCRErrs" , f : parsenoop } , 610 : { n : "BrtCrashRecErr" , f : parsenoop } , 611 : { n : "BrtBeginFonts" , f : parsenoop } , 612 : { n : "BrtEndFonts" , f : parsenoop } , 613 : { n : "BrtBeginBorders" , f : parsenoop } , 614 : { n : "BrtEndBorders" , f : parsenoop } , 615 : { n : "BrtBeginFmts" , f : parsenoop } , 616 : { n : "BrtEndFmts" , f : parsenoop } , 617 : { n : "BrtBeginCellXFs" , f : parsenoop } , 618 : { n : "BrtEndCellXFs" , f : parsenoop } , 619 : { n : "BrtBeginStyles" , f : parsenoop } , 620 : { n : "BrtEndStyles" , f : parsenoop } , 625 : { n : "BrtBigName" , f : parsenoop } , 626 : { n : "BrtBeginCellStyleXFs" , f : parsenoop } , 627 : { n : "BrtEndCellStyleXFs" , f : parsenoop } , 628 : { n : "BrtBeginComments" , f : parsenoop } , 629 : { n : "BrtEndComments" , f : parsenoop } , 630 : { n : "BrtBeginCommentAuthors" , f : parsenoop } , 631 : { n : "BrtEndCommentAuthors" , f : parsenoop } , 632 : { n : "BrtCommentAuthor" , f : parse _BrtCommentAuthor } , 633 : { n : "BrtBeginCommentList" , f : parsenoop } , 634 : { n : "BrtEndCommentList" , f : parsenoop } , 635 : { n : "BrtBeginComment" , f : parse _BrtBeginComment } , 636 : { n : "BrtEndComment" , f : parsenoop } , 637 : { n : "BrtCommentText" , f : parse _BrtCommentText } , 638 : { n : "BrtBeginOleObjects" , f : parsenoop } , 639 : { n : "BrtOleObject" , f : parsenoop } , 640 : { n : "BrtEndOleObjects" , f : parsenoop } , 641 : { n : "BrtBeginSxrules" , f : parsenoop } , 642 : { n : "BrtEndSxRules" , f : parsenoop } , 643 : { n : "BrtBeginActiveXControls" , f : parsenoop } , 644 : { n : "BrtActiveX" , f : parsenoop } , 645 : { n : "BrtEndActiveXControls" , f : parsenoop } , 646 : { n : "BrtBeginPCDSDTCEMembersSortBy" , f : parsenoop } , 648 : { n : "BrtBeginCellIgnoreECs" , f : parsenoop } , 649 : { n : "BrtCellIgnoreEC" , f : parsenoop } , 650 : { n : "BrtEndCellIgnoreECs" , f : parsenoop } , 651 : { n : "BrtCsProp" , f : parsenoop } , 652 : { n : "BrtCsPageSetup" , f : parsenoop } , 653 : { n : "BrtBeginUserCsViews" , f : parsenoop } , 654 : { n : "BrtEndUserCsViews" , f : parsenoop } , 655 : { n : "BrtBeginUserCsView" , f : parsenoop } , 656 : { n : "BrtEndUserCsView" , f : parsenoop } , 657 : { n : "BrtBeginPcdSFCIEntries" , f : parsenoop } , 658 : { n : "BrtEndPCDSFCIEntries" , f : parsenoop } , 659 : { n : "BrtPCDSFCIEntry" , f : parsenoop } , 660 : { n : "BrtBeginListParts" , f : parsenoop } , 661 : { n : "BrtListPart" , f : parsenoop } , 662 : { n : "BrtEndListParts" , f : parsenoop } , 663 : { n : "BrtSheetCalcProp" , f : parsenoop } , 664 : { n : "BrtBeginFnGroup" , f : parsenoop } , 665 : { n : "BrtFnGroup" , f : parsenoop } , 666 : { n : "BrtEndFnGroup" , f : parsenoop } , 667 : { n : "BrtSupAddin" , f : parsenoop } , 668 : { n : "BrtSXTDMPOrder" , f : parsenoop } , 669 : { n : "BrtCsProtection" , f : parsenoop } , 671 : { n : "BrtBeginWsSortMap" , f : parsenoop } , 672 : { n : "BrtEndWsSortMap" , f : parsenoop } , 673 : { n : "BrtBeginRRSort" , f : parsenoop } , 674 : { n : "BrtEndRRSort" , f : parsenoop } , 675 : { n : "BrtRRSortItem" , f : parsenoop } , 676 : { n : "BrtFileSharingIso" , f : parsenoop } , 677 : { n : "BrtBookProtectionIso" , f : parsenoop } , 678 : { n : "BrtSheetProtectionIso" , f : parsenoop } , 679 : { n : "BrtCsProtectionIso" , f : parsenoop } , 680 : { n : "BrtRangeProtectionIso" , f : parsenoop } , 1024 : { n : "BrtRwDescent" , f : parsenoop } , 1025 : { n : "BrtKnownFonts" , f : parsenoop } , 1026 : { n : "BrtBeginSXTupleSet" , f : parsenoop } , 1027 : { n : "BrtEndSXTupleSet" , f : parsenoop } , 1028 : { n : "BrtBeginSXTupleSetHeader" , f : parsenoop } , 1029 : { n : "BrtEndSXTupleSetHeader" , f : parsenoop } , 1030 : { n : "BrtSXTupleSetHeaderItem" , f : parsenoop } , 1031 : { n : "BrtBeginSXTupleSetData" , f : parsenoop } , 1032 : { n : "BrtEndSXTupleSetData" , f : parsenoop } , 1033 : { n : "BrtBeginSXTupleSetRow" , f : parsenoop } , 1034 : { n : "BrtEndSXTupleSetRow" , f : parsenoop } , 1035 : { n : "BrtSXTupleSetRowItem" , f : parsenoop } , 1036 : { n : "BrtNameExt" , f : parsenoop } , 1037 : { n : "BrtPCDH14" , f : parsenoop } , 1038 : { n : "BrtBeginPCDCalcMem14" , f : parsenoop } , 1039 : { n : "BrtEndPCDCalcMem14" , f : parsenoop } , 1040 : { n : "BrtSXTH14" , f : parsenoop } , 1041 : { n : "BrtBeginSparklineGroup" , f : parsenoop } , 1042 : { n : "BrtEndSparklineGroup" , f : parsenoop } , 1043 : { n : "BrtSparkline" , f : parsenoop } , 1044 : { n : "BrtSXDI14" , f : parsenoop } , 1045 : { n :
"day-of-week" : [ "ddd" , "dddd" ] } ; return function pcx ( d , _opts ) { var opts = _opts || { } ; var str = xlml _normalize ( d ) ; var state = [ ] , tmp ; var tag ; var NFtag = { name : "" } , NF = "" , pidx = 0 ; var sheetag ; var rowtag ; var Sheets = { } , SheetNames = [ ] , ws = { } ; var Rn , q ; var ctag = { value : "" } ; var textp = "" , textpidx = 0 , textptag ; var R = - 1 , C = - 1 , range = { s : { r : 1e6 , c : 1e7 } , e : { r : 0 , c : 0 } } ; var number _format _map = { } ; var merges = [ ] , mrange = { } , mR = 0 , mC = 0 ; var arrayf = [ ] ; var comments = [ ] , comment = { } ; var creator = "" , creatoridx = 0 ; var rept = 1 , isstub = false ; var i = 0 ; xlmlregex . lastIndex = 0 ; str = str . replace ( /<!--([^\u2603]*?)-->/gm , "" ) . replace ( /<!DOCTYPE[^\[]*\[[^\]]*\]>/gm , "" ) ; while ( Rn = xlmlregex . exec ( str ) ) switch ( Rn [ 3 ] = Rn [ 3 ] . replace ( /_.*$/ , "" ) ) { case "table" : case "工作表" : if ( Rn [ 1 ] === "/" ) { if ( range . e . c >= range . s . c && range . e . r >= range . s . r ) ws [ "!ref" ] = encode _range ( range ) ; if ( merges . length ) ws [ "!merges" ] = merges ; sheetag . name = utf8read ( sheetag [ "名称" ] || sheetag . name ) ; SheetNames . push ( sheetag . name ) ; Sheets [ sheetag . name ] = ws } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) { sheetag = parsexmltag ( Rn [ 0 ] , false ) ; R = C = - 1 ; range . s . r = range . s . c = 1e7 ; range . e . r = range . e . c = 0 ; ws = { } ; merges = [ ] } break ; case "table-row" : case "行" : if ( Rn [ 1 ] === "/" ) break ; rowtag = parsexmltag ( Rn [ 0 ] , false ) ; if ( rowtag [ "行号" ] ) R = rowtag [ "行号" ] - 1 ; else ++ R ; C = - 1 ; break ; case "covered-table-cell" : ++ C ; if ( opts . sheetStubs ) ws [ encode _cell ( { r : R , c : C } ) ] = { t : "z" } ; break ; case "table-cell" : case "数据" : if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) === "/" ) { ctag = parsexmltag ( Rn [ 0 ] , false ) ; if ( ctag [ "number-columns-repeated" ] ) C += parseInt ( ctag [ "number-columns-repeated" ] , 10 ) ; else ++ C } else if ( Rn [ 1 ] !== "/" ) { ++ C ; rept = 1 ; if ( C > range . e . c ) range . e . c = C ; if ( R > range . e . r ) range . e . r = R ; if ( C < range . s . c ) range . s . c = C ; if ( R < range . s . r ) range . s . r = R ; ctag = parsexmltag ( Rn [ 0 ] , false ) ; comments = [ ] ; comment = { } ; q = { t : ctag [ "数据类型" ] || ctag [ "value-type" ] , v : null } ; if ( opts . cellFormula ) { if ( ctag . formula ) ctag . formula = unescapexml ( ctag . formula ) ; if ( ctag [ "number-matrix-columns-spanned" ] && ctag [ "number-matrix-rows-spanned" ] ) { mR = parseInt ( ctag [ "number-matrix-rows-spanned" ] , 10 ) || 0 ; mC = parseInt ( ctag [ "number-matrix-columns-spanned" ] , 10 ) || 0 ; mrange = { s : { r : R , c : C } , e : { r : R + mR - 1 , c : C + mC - 1 } } ; q . F = encode _range ( mrange ) ; arrayf . push ( [ mrange , q . F ] ) } if ( ctag . formula ) q . f = ods _to _csf _formula ( ctag . formula ) ; else for ( i = 0 ; i < arrayf . length ; ++ i ) if ( R >= arrayf [ i ] [ 0 ] . s . r && R <= arrayf [ i ] [ 0 ] . e . r ) if ( C >= arrayf [ i ] [ 0 ] . s . c && C <= arrayf [ i ] [ 0 ] . e . c ) q . F = arrayf [ i ] [ 1 ] } if ( ctag [ "number-columns-spanned" ] || ctag [ "number-rows-spanned" ] ) { mR = parseInt ( ctag [ "number-rows-spanned" ] , 10 ) || 0 ; mC = parseInt ( ctag [ "number-columns-spanned" ] , 10 ) || 0 ; mrange = { s : { r : R , c : C } , e : { r : R + mR - 1 , c : C + mC - 1 } } ; merges . push ( mrange ) } if ( ctag [ "number-columns-repeated" ] ) rept = parseInt ( ctag [ "number-columns-repeated" ] , 10 ) ; switch ( q . t ) { case "boolean" : q . t = "b" ; q . v = parsexmlbool ( ctag [ "boolean-value" ] ) ; break ; case "float" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "percentage" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "currency" : q . t = "n" ; q . v = parseFloat ( ctag . value ) ; break ; case "date" : q . t = "d" ; q . v = parseDate ( ctag [ "date-value" ] ) ; if ( ! opts . cellDates ) { q . t = "n" ; q . v = datenum ( q . v ) } q . z = "m/d/yy" ; break ; case "time" : q . t = "n" ; q . v = parse _isodur ( ctag [ "time-value" ] ) / 86400 ; break ; case "number" : q . t = "n" ; q . v = parseFloat ( ctag [ "数据数值" ] ) ; break ; default : if ( q . t === "string" || q . t === "text" || ! q . t ) { q . t = "s" ; if ( ctag [ "string-value" ] != null ) textp = unescapexml ( ctag [ "string-value" ] ) } else throw new Error ( "Unsupported value type " + q . t ) } } else { isstub = false ; if ( q . t === "s" ) { q . v = textp || "" ; isstub = textpidx == 0 } if ( comments . length > 0 ) { q . c = comments ; comments = [ ] } if ( textp ) q . w = textp ; if ( ! isstub || opts . sheetStubs ) { if ( ! ( opts . sheetRows && opts . sheetRows < R ) ) { ws [ encode _cell ( { r : R , c : C } ) ] = q ; while ( -- rept > 0 ) ws [ encode _cell ( { r : R , c : ++ C } ) ] = dup ( q ) ; if ( range . e . c <= C ) range . e . c = C } } else { C += rept ; rept = 0 } q = { } ; textp = "" } break ; case "document" : case "document-content" : case "电子表格文档" : case "spreadsheet" : case "主体" : case "scripts" : case "styles" : case "font-face-decls" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ] . length - 2 ) !== "/" ) state . push ( [ Rn [ 3 ] , true ] ) ; break ; case "annotation" : if ( Rn [ 1 ] === "/" ) { if ( ( tmp = state . pop ( ) ) [ 0 ] !== Rn [ 3 ] ) throw "Bad state: " + tmp ; comment . t = textp ; comment . a = creator ; comments . push ( comment ) } else if ( Rn [ 0 ] . charAt ( Rn [ 0 ]
switch ( typeof range ) { case "string" : r = safe _decode _range ( range ) ; break ; case "number" : r = safe _decode _range ( sheet [ "!ref" ] ) ; r . s . r = range ; break ; default : r = range } if ( header > 0 ) offset = 0 ; var rr = encode _row ( r . s . r ) ; var cols = new Array ( r . e . c - r . s . c + 1 ) ; var out = new Array ( r . e . r - r . s . r - offset + 1 ) ; var outi = 0 ; for ( C = r . s . c ; C <= r . e . c ; ++ C ) { cols [ C ] = encode _col ( C ) ; val = sheet [ cols [ C ] + rr ] ; switch ( header ) { case 1 : hdr [ C ] = C ; break ; case 2 : hdr [ C ] = cols [ C ] ; break ; case 3 : hdr [ C ] = o . header [ C - r . s . c ] ; break ; default : if ( val == null ) continue ; vv = v = format _cell ( val , null , o ) ; var counter = 0 ; for ( var CC = 0 ; CC < hdr . length ; ++ CC ) if ( hdr [ CC ] == vv ) vv = v + "_" + ++ counter ; hdr [ C ] = vv } } for ( R = r . s . r + offset ; R <= r . e . r ; ++ R ) { rr = encode _row ( R ) ; isempty = true ; if ( header === 1 ) row = [ ] ; else { row = { } ; if ( Object . defineProperty ) try { Object . defineProperty ( row , "__rowNum__" , { value : R , enumerable : false } ) } catch ( e ) { row . _ _rowNum _ _ = R } else row . _ _rowNum _ _ = R } for ( C = r . s . c ; C <= r . e . c ; ++ C ) { val = sheet [ cols [ C ] + rr ] ; if ( val === undefined || val . t === undefined ) { if ( defval === undefined ) continue ; if ( hdr [ C ] != null ) { row [ hdr [ C ] ] = defval ; isempty = false } continue } v = val . v ; switch ( val . t ) { case "z" : if ( v == null ) break ; continue ; case "e" : continue ; case "s" : case "d" : case "b" : case "n" : break ; default : throw new Error ( "unrecognized type " + val . t ) } if ( hdr [ C ] != null ) { if ( v == null ) { if ( defval !== undefined ) row [ hdr [ C ] ] = defval ; else if ( raw && v === null ) row [ hdr [ C ] ] = null ; else continue } else { row [ hdr [ C ] ] = raw ? v : format _cell ( val , v , o ) } isempty = false } } if ( isempty === false || ( header === 1 ? o . blankrows !== false : ! ! o . blankrows ) ) out [ outi ++ ] = row } out . length = outi ; return out } function sheet _to _csv ( sheet , opts ) { var out = "" , txt = "" , qreg = /"/g ; var o = opts == null ? { } : opts ; if ( sheet == null || sheet [ "!ref" ] == null ) return "" ; var r = safe _decode _range ( sheet [ "!ref" ] ) ; var FS = o . FS !== undefined ? o . FS : "," , fs = FS . charCodeAt ( 0 ) ; var RS = o . RS !== undefined ? o . RS : "\n" , rs = RS . charCodeAt ( 0 ) ; var endregex = new RegExp ( ( FS == "|" ? "\\|" : FS ) + "+$" ) ; var row = "" , rr = "" , cols = [ ] ; var i = 0 , cc = 0 , val ; var R = 0 , C = 0 ; for ( C = r . s . c ; C <= r . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; for ( R = r . s . r ; R <= r . e . r ; ++ R ) { var isempty = true ; row = "" ; rr = encode _row ( R ) ; for ( C = r . s . c ; C <= r . e . c ; ++ C ) { val = sheet [ cols [ C ] + rr ] ; if ( val == null ) txt = "" ; else if ( val . v != null ) { isempty = false ; txt = "" + format _cell ( val , null , o ) ; for ( i = 0 , cc = 0 ; i !== txt . length ; ++ i ) if ( ( cc = txt . charCodeAt ( i ) ) === fs || cc === rs || cc === 34 ) { txt = '"' + txt . replace ( qreg , '""' ) + '"' ; break } } else if ( val . f != null && ! val . F ) { isempty = false ; txt = "=" + val . f ; if ( txt . indexOf ( "," ) >= 0 ) txt = '"' + txt . replace ( qreg , '""' ) + '"' } else txt = "" ; row += ( C === r . s . c ? "" : FS ) + txt } if ( o . blankrows === false && isempty ) continue ; if ( o . strip ) row = row . replace ( endregex , "" ) ; out += row + RS } return out } var make _csv = sheet _to _csv ; function sheet _to _txt ( sheet , opts ) { if ( ! opts ) opts = { } ; opts . FS = "\t" ; opts . RS = "\n" ; var s = sheet _to _csv ( sheet , opts ) ; if ( typeof cptable == "undefined" ) return s ; var o = cptable . utils . encode ( 1200 , s ) ; return "ÿþ" + o } function sheet _to _formulae ( sheet ) { var y = "" , x , val = "" ; if ( sheet == null || sheet [ "!ref" ] == null ) return [ ] ; var r = safe _decode _range ( sheet [ "!ref" ] ) , rr = "" , cols = [ ] , C ; var cmds = new Array ( ( r . e . r - r . s . r + 1 ) * ( r . e . c - r . s . c + 1 ) ) ; var i = 0 ; for ( C = r . s . c ; C <= r . e . c ; ++ C ) cols [ C ] = encode _col ( C ) ; for ( var R = r . s . r ; R <= r . e . r ; ++ R ) { rr = encode _row ( R ) ; for ( C = r . s . c ; C <= r . e . c ; ++ C ) { y = cols [ C ] + rr ; x = sheet [ y ] ; val = "" ; if ( x === undefined ) continue ; else if ( x . F != null ) { y = x . F ; if ( ! x . f ) continue ; val = x . f ; if ( y . indexOf ( ":" ) == - 1 ) y = y + ":" + y } if ( x . f != null ) val = x . f ; else if ( x . t == "z" ) continue ; else if ( x . t == "n" && x . v != null ) val = "" + x . v ; else if ( x . t == "b" ) val = x . v ? "TRUE" : "FALSE" ; else if ( x . w !== undefined ) val = "'" + x . w ; else if ( x . v === undefined ) continue ; else if ( x . t == "s" ) val = "'" + x . v ; else val = "" + x . v ; cmds [ i ++ ] = y + "=" + val } } cmds . length = i ; return cmds } var utils = { encode _col : encode _col , encode _row : encode _row , encode _cell : encode _cell , encode _range : encode _range , decode _col : decode _col , decode _row : decode _row , split _cell : split _cell , decode _cell : decode _cell , decode _range : decode _range , format _cell : format _cell , get _formulae : sheet _to _formulae , make _csv : sheet _to _csv , make _json : sheet _to _json , make _formulae : sheet _to _formulae , aoa _to _sheet : aoa _to _sheet , table _to _sheet : parse _dom _table , table _to _book : table _to _book , sheet _to _csv : sheet _to _csv , sheet _to _json : sheet _to _json , sheet _to _formulae : sheet _to _formulae , sheet _to _row _object _array : sheet _to _json } ; XLSX . parse _xlscfb = parse _xlscfb ; XLSX . parse _ods = parse _ods ;