2016-12-31 08:20:45 +00:00
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
2017-02-10 19:23:01 +00:00
var XLSX = { } ; ( function make _xlsx ( XLSX ) { XLSX . version = "0.8.3" ; var current _codepage = 1200 , current _cptable ; if ( typeof module !== "undefined" && typeof require !== "undefined" ) { if ( typeof cptable === "undefined" ) cptable = require ( "./dist/cpexcel" ) ; 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 _xml = function ( data ) { 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 _xml = 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" ; 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.8.1" ; function _strrev ( x ) { var o = "" , i = x . length - 1 ; while ( i >= 0 ) o += x . charAt ( i -- ) ; return o } function fill ( c , l ) { var o = "" ; while ( o . length < l ) o += c ; return o } function pad0 ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } function pad _ ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( " " , d - t . length ) + t } function rpad _ ( v , d ) { var t = "" + v ; return t . length >= d ? t : t + fill ( " " , d - t . length ) } function pad0r1 ( v , d ) { var t = "" + Math . round ( v ) ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } function pad0r2 ( v , d ) { var t = "" + v ; return t . length >= d ? t : fill ( "0" , d - t . length ) + t } var p2 _32 = Math . pow ( 2 , 32 ) ; function pad0r ( v , d ) { if ( v > p2 _32 || v < - p2 _32 ) return pad0r1 ( v , d ) ; var i = Math . round ( v ) ; return pad0r2 ( i , d ) } function isgeneral ( s , i ) { 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 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" ,
jj = j * 4 & modulus ; if ( ssz < 4 + jj ) throw "FAT boundary crossed: " + j + " 4 " + ssz ; 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 "FAT boundary crossed: " + j + " 4 " + ssz ; 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 , offset ) { return new Date ( ( _ _readUInt32LE ( blob , offset + 4 ) / 1e7 * Math . pow ( 2 , 32 ) + _ _readUInt32LE ( blob , offset ) / 1e7 - 11644473600 ) * 1e3 ) } var fs ; function readFileSync ( filename , options ) { if ( fs === undefined ) fs = require ( "fs" ) ; return parse ( fs . readFileSync ( filename ) , options ) } function readSync ( blob , options ) { switch ( options !== undefined && options . type !== undefined ? options . type : "base64" ) { case "file" : return readFileSync ( blob , options ) ; case "base64" : return parse ( s2a ( Base64 . decode ( blob ) ) , options ) ; case "binary" : return parse ( s2a ( blob ) , options ) } return parse ( blob ) } var MSSZ = 64 ; var ENDOFCHAIN = - 2 ; var HEADER _SIGNATURE = "d0cf11e0a1b11ae1" ; var HEADER _CLSID = "00000000000000000000000000000000" ; var consts = { MAXREGSECT : - 6 , DIFSECT : - 4 , FATSECT : - 3 , ENDOFCHAIN : ENDOFCHAIN , FREESECT : - 1 , HEADER _SIGNATURE : HEADER _SIGNATURE , HEADER _MINOR _VERSION : "3e00" , MAXREGSID : - 6 , NOSTREAM : - 1 , HEADER _CLSID : HEADER _CLSID , EntryTypes : [ "unknown" , "storage" , "stream" , "lockbytes" , "property" , "root" ] } ; exports . read = readSync ; exports . parse = parse ; exports . utils = { ReadShift : ReadShift , CheckField : CheckField , prep _blob : prep _blob , bconcat : bconcat , consts : consts } ; return exports } ( ) ; if ( typeof require !== "undefined" && typeof module !== "undefined" && typeof DO _NOT _EXPORT _CFB === "undefined" ) { module . exports = CFB } function isval ( x ) { return x !== undefined && x !== null } function keys ( o ) { return Object . keys ( o ) } function evert _key ( obj , key ) { var o = [ ] , K = keys ( obj ) ; for ( var i = 0 ; i !== K . length ; ++ i ) o [ obj [ K [ i ] ] [ key ] ] = K [ i ] ; return o } function evert ( obj ) { var o = [ ] , K = keys ( obj ) ; for ( var i = 0 ; i !== K . length ; ++ i ) o [ obj [ K [ i ] ] ] = K [ i ] ; return o } function evert _num ( obj ) { var o = [ ] , K = keys ( obj ) ; for ( var i = 0 ; i !== K . length ; ++ i ) o [ obj [ K [ i ] ] ] = parseInt ( K [ i ] , 10 ) ; return o } function evert _arr ( obj ) { var o = [ ] , K = keys ( obj ) ; for ( var i = 0 ; i !== K . length ; ++ i ) { if ( o [ obj [ K [ i ] ] ] == null ) o [ obj [ K [ i ] ] ] = [ ] ; o [ obj [ K [ i ] ] ] . push ( K [ i ] ) } return o } function datenum ( v , date1904 ) { if ( date1904 ) v += 1462 ; var epoch = Date . parse (
"application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml" : "TODO" , "application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml" : "TODO" , "application/vnd.openxmlformats-officedocument.vmlDrawing" : "TODO" , "application/vnd.openxmlformats-package.relationships+xml" : "rels" , "application/vnd.openxmlformats-officedocument.oleObject" : "TODO" , sheet : "js" } ; var CT _LIST = function ( ) { var o = { workbooks : { xlsx : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" , xlsm : "application/vnd.ms-excel.sheet.macroEnabled.main+xml" , xlsb : "application/vnd.ms-excel.sheet.binary.macroEnabled.main" , xltx : "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml" } , strs : { xlsx : "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml" , xlsb : "application/vnd.ms-excel.sharedStrings" } , sheets : { xlsx : "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" , xlsb : "application/vnd.ms-excel.worksheet" } , styles : { xlsx : "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" , xlsb : "application/vnd.ms-excel.styles" } } ; keys ( o ) . forEach ( function ( k ) { if ( ! o [ k ] . xlsm ) o [ k ] . xlsm = o [ k ] . xlsx } ) ; keys ( o ) . forEach ( function ( k ) { keys ( o [ k ] ) . forEach ( function ( v ) { ct2type [ o [ k ] [ v ] ] = k } ) } ) ; return o } ( ) ; var type2ct = evert _arr ( ct2type ) ; XMLNS . CT = "http://schemas.openxmlformats.org/package/2006/content-types" ; function parse _ct ( data , opts ) { var ct = { workbooks : [ ] , sheets : [ ] , calcchains : [ ] , themes : [ ] , styles : [ ] , coreprops : [ ] , extprops : [ ] , custprops : [ ] , strs : [ ] , comments : [ ] , vba : [ ] , TODO : [ ] , rels : [ ] , xmlns : "" } ; if ( ! data || ! data . match ) return ct ; var ctext = { } ; ( data . match ( tagregex ) || [ ] ) . forEach ( function ( x ) { var y = parsexmltag ( x ) ; switch ( y [ 0 ] . replace ( nsregex , "<" ) ) { case "<?xml" : break ; case "<Types" : ct . xmlns = y [ "xmlns" + ( y [ 0 ] . match ( /<(\w+):/ ) || [ "" , "" ] ) [ 1 ] ] ; break ; case "<Default" : ctext [ y . Extension ] = y . ContentType ; break ; case "<Override" : if ( ct [ ct2type [ y . ContentType ] ] !== undefined ) ct [ ct2type [ y . ContentType ] ] . push ( y . PartName ) ; else if ( opts . WTF ) console . error ( y ) ; break } } ) ; if ( ct . xmlns !== XMLNS . CT ) throw new Error ( "Unknown Namespace: " + ct . xmlns ) ; ct . calcchain = ct . calcchains . length > 0 ? ct . calcchains [ 0 ] : "" ; ct . sst = ct . strs . length > 0 ? ct . strs [ 0 ] : "" ; ct . style = ct . styles . length > 0 ? ct . styles [ 0 ] : "" ; ct . defaults = ctext ; delete ct . calcchains ; return ct } var CTYPE _XML _ROOT = writextag ( "Types" , null , { xmlns : XMLNS . CT , "xmlns:xsd" : XMLNS . xsd , "xmlns:xsi" : XMLNS . xsi } ) ; var CTYPE _DEFAULTS = [ [ "xml" , "application/xml" ] , [ "bin" , "application/vnd.ms-excel.sheet.binary.macroEnabled.main" ] , [ "rels" , type2ct . rels [ 0 ] ] ] . map ( function ( x ) { return writextag ( "Default" , null , { Extension : x [ 0 ] , ContentType : x [ 1 ] } ) } ) ; function write _ct ( ct , opts ) { var o = [ ] , v ; o [ o . length ] = XML _HEADER ; o [ o . length ] = CTYPE _XML _ROOT ; o = o . concat ( CTYPE _DEFAULTS ) ; var f1 = function ( w ) { if ( ct [ w ] && ct [ w ] . length > 0 ) { v = ct [ w ] [ 0 ] ; o [ o . length ] = writextag ( "Override" , null , { PartName : ( v [ 0 ] == "/" ? "" : "/" ) + v , ContentType : CT _LIST [ w ] [ opts . bookType || "xlsx" ] } ) } } ; var f2 = function ( w ) { ct [ w ] . forEach ( function ( v ) { o [ o . length ] = writextag ( "Override" , null , { PartName : ( v [ 0 ] == "/" ? "" : "/" ) + v , ContentType : CT _LIST [ w ] [ opts . bookType || "xlsx" ] } ) } ) } ; var f3 = function ( t ) { ( ct [ t ] || [ ] ) . forEach ( function ( v ) { o [ o . length ] = writextag ( "Override" , null , { PartName : ( v [ 0 ] == "/" ? "" : "/" ) + v , ContentType : type2ct [ t ] [ 0 ] } ) } ) } ; f1 ( "workbooks" ) ; f2 ( "sheets" ) ; f3 ( "themes" ) ; [ "strs" , "styles" ] . forEach ( f1 ) ; [ "coreprops" , "extprops" , "custprops" ] . forEach ( f3 ) ; if ( o . length > 2 ) { o [ o . length ] = "</Types>" ; o [ 1 ] = o [ 1 ] . replace ( "/>" , ">" ) } return o . join ( "" ) } var RELS = { WB : "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" , SHEET : "http://sheetjs.openxmlformats.org/officeDocument/2006/relationships/officeDocument" } ; function parse _rels ( data , currentFilePath ) { if ( ! data ) return data ; if ( currentFilePath . charAt ( 0 ) !== "/" ) { currentFilePath = "/" + currentFilePath } var rels = { } ; var hash = { } ; var resolveRelativePathIntoAbsolute = function ( to ) { var toksFrom = currentFilePath . split ( "/" ) ; toksFrom . pop ( ) ; var toksTo = to . split ( "/" ) ; var reversed = [ ] ; while ( toksTo . length !== 0 ) { var tokTo = toksTo . shift ( ) ; if ( tokTo === ".." ) { toksFrom . pop ( ) } else if ( tokTo !== "." ) { toksFrom . push ( tokTo ) } } return toksFrom . join ( "/" ) } ; ( data . match ( tagregex ) || [ ] ) . forEach ( function ( x ) { var y = parsexmltag (
if ( blob . l - s != blob . lens [ i ] ) throw "TxO: bad continue record" ; var hdr = blob [ blob . l ] ; var t = parse _XLUnicodeStringNoCch ( blob , blob . lens [ i + 1 ] - blob . lens [ i ] - 1 ) ; texts += t ; if ( texts . length >= ( hdr ? cchText : 2 * cchText ) ) break } if ( texts . length !== cchText && texts . length !== cchText * 2 ) { throw "cchText: " + cchText + " != " + texts . length } blob . l = s + length ; return { t : texts } } catch ( e ) { blob . l = s + length ; return { t : texts } } } var parse _HLink = function ( blob , length ) { var ref = parse _Ref8U ( blob , 8 ) ; blob . l += 16 ; var hlink = parse _Hyperlink ( blob , length - 24 ) ; return [ ref , hlink ] } ; var parse _HLinkTooltip = function ( blob , length ) { var end = blob . l + length ; blob . read _shift ( 2 ) ; var ref = parse _Ref8U ( blob , 8 ) ; var wzTooltip = blob . read _shift ( ( length - 10 ) / 2 , "dbcs-cont" ) ; wzTooltip = wzTooltip . replace ( chr0 , "" ) ; return [ ref , wzTooltip ] } ; function parse _Country ( blob , length ) { var o = [ ] , d ; d = blob . read _shift ( 2 ) ; o [ 0 ] = CountryEnum [ d ] || d ; d = blob . read _shift ( 2 ) ; o [ 1 ] = CountryEnum [ d ] || d ; return o } function parse _ClrtClient ( blob , length ) { var ccv = blob . read _shift ( 2 ) ; var o = [ ] ; while ( ccv -- > 0 ) o . push ( parse _LongRGB ( blob , 8 ) ) ; return o } function parse _Palette ( blob , length ) { var ccv = blob . read _shift ( 2 ) ; var o = [ ] ; while ( ccv -- > 0 ) o . push ( parse _LongRGB ( blob , 8 ) ) ; return o } function parse _XFCRC ( blob , length ) { blob . l += 2 ; var o = { cxfs : 0 , crc : 0 } ; o . cxfs = blob . read _shift ( 2 ) ; o . crc = blob . read _shift ( 4 ) ; return o } var parse _Style = parsenoop ; var parse _StyleExt = parsenoop ; var parse _ColInfo = parsenoop ; var parse _Window2 = parsenoop ; var parse _Backup = parsebool ; var parse _Blank = parse _XLSCell ; var parse _BottomMargin = parse _Xnum ; var parse _BuiltInFnGroupCount = parseuint16 ; var parse _CalcCount = parseuint16 ; var parse _CalcDelta = parse _Xnum ; var parse _CalcIter = parsebool ; var parse _CalcMode = parseuint16 ; var parse _CalcPrecision = parsebool ; var parse _CalcRefMode = parsenoop2 ; var parse _CalcSaveRecalc = parsebool ; var parse _CodePage = parseuint16 ; var parse _Compat12 = parsebool ; var parse _Date1904 = parsebool ; var parse _DefColWidth = parseuint16 ; var parse _DSF = parsenoop2 ; var parse _EntExU2 = parsenoop2 ; var parse _EOF = parsenoop2 ; var parse _Excel9File = parsenoop2 ; var parse _FeatHdr = parsenoop2 ; var parse _FontX = parseuint16 ; var parse _Footer = parse _XLHeaderFooter ; var parse _GridSet = parseuint16 ; var parse _HCenter = parsebool ; var parse _Header = parse _XLHeaderFooter ; var parse _HideObj = parse _HideObjEnum ; var parse _InterfaceEnd = parsenoop2 ; var parse _LeftMargin = parse _Xnum ; var parse _Mms = parsenoop2 ; var parse _ObjProtect = parsebool ; var parse _Password = parseuint16 ; var parse _PrintGrid = parsebool ; var parse _PrintRowCol = parsebool ; var parse _PrintSize = parseuint16 ; var parse _Prot4Rev = parsebool ; var parse _Prot4RevPass = parseuint16 ; var parse _Protect = parsebool ; var parse _RefreshAll = parsebool ; var parse _RightMargin = parse _Xnum ; var parse _RRTabId = parseuint16a ; var parse _ScenarioProtect = parsebool ; var parse _Scl = parseuint16a ; var parse _String = parse _XLUnicodeString ; var parse _SxBool = parsebool ; var parse _TopMargin = parse _Xnum ; var parse _UsesELFs = parsebool ; var parse _VCenter = parsebool ; var parse _WinProtect = parsebool ; var parse _WriteProtect = parsenoop ; var parse _VerticalPageBreaks = parsenoop ; var parse _HorizontalPageBreaks = parsenoop ; var parse _Selection = parsenoop ; var parse _Continue = parsenoop ; var parse _Pane = parsenoop ; var parse _Pls = parsenoop ; var parse _DCon = parsenoop ; var parse _DConRef = parsenoop ; var parse _DConName = parsenoop ; var parse _XCT = parsenoop ; var parse _CRN = parsenoop ; var parse _FileSharing = parsenoop ; var parse _Uncalced = parsenoop ; var parse _Template = parsenoop ; var parse _Intl = parsenoop ; var parse _WsBool = parsenoop ; var parse _Sort = parsenoop ; var parse _Sync = parsenoop ; var parse _LPr = parsenoop ; var parse _DxGCol = parsenoop ; var parse _FnGroupName = parsenoop ; var parse _FilterMode = parsenoop ; var parse _AutoFilterInfo = parsenoop ; var parse _AutoFilter = parsenoop ; var parse _Setup = parsenoop ; var parse _ScenMan = parsenoop ; var parse _SCENARIO = parsenoop ; var parse _SxView = parsenoop ; var parse _Sxvd = parsenoop ; var parse _SXVI = parsenoop ; var parse _SxIvd = parsenoop ; var parse _SXLI = parsenoop ; var parse _SXPI = parsenoop ; var parse _DocRoute = parsenoop ; var parse _RecipName = parsenoop ; var parse _MulBlank = parsenoop ; var parse _SXDI = parsenoop ; var parse _SXDB = parsenoop ; var parse _SXFDB = parsenoop ; var parse _SXDBB = parsenoop ; var parse _SXNum = parsenoop ; var parse _SxErr = parsenoop ; var parse _SXI
m [ 2 ] ( t , opts ) } ) } var themeltregex = /<a:themeElements([^>]*)>[^\u2603]*<\/a:themeElements>/ ; function parse _theme _xml ( data , opts ) { if ( ! data || data . length === 0 ) return themes ; var t ; if ( ! ( t = data . match ( themeltregex ) ) ) throw "themeElements not found in theme" ; parse _themeElements ( t [ 0 ] , opts ) ; return themes } function write _theme ( ) { var o = [ XML _HEADER ] ; o [ o . length ] = '<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">' ; o [ o . length ] = "<a:themeElements>" ; o [ o . length ] = '<a:clrScheme name="Office">' ; o [ o . length ] = '<a:dk1><a:sysClr val="windowText" lastClr="000000"/></a:dk1>' ; o [ o . length ] = '<a:lt1><a:sysClr val="window" lastClr="FFFFFF"/></a:lt1>' ; o [ o . length ] = '<a:dk2><a:srgbClr val="1F497D"/></a:dk2>' ; o [ o . length ] = '<a:lt2><a:srgbClr val="EEECE1"/></a:lt2>' ; o [ o . length ] = '<a:accent1><a:srgbClr val="4F81BD"/></a:accent1>' ; o [ o . length ] = '<a:accent2><a:srgbClr val="C0504D"/></a:accent2>' ; o [ o . length ] = '<a:accent3><a:srgbClr val="9BBB59"/></a:accent3>' ; o [ o . length ] = '<a:accent4><a:srgbClr val="8064A2"/></a:accent4>' ; o [ o . length ] = '<a:accent5><a:srgbClr val="4BACC6"/></a:accent5>' ; o [ o . length ] = '<a:accent6><a:srgbClr val="F79646"/></a:accent6>' ; o [ o . length ] = '<a:hlink><a:srgbClr val="0000FF"/></a:hlink>' ; o [ o . length ] = '<a:folHlink><a:srgbClr val="800080"/></a:folHlink>' ; o [ o . length ] = "</a:clrScheme>" ; o [ o . length ] = '<a:fontScheme name="Office">' ; o [ o . length ] = "<a:majorFont>" ; o [ o . length ] = '<a:latin typeface="Cambria"/>' ; 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="Times New Roman"/>' ; o [ o . length ] = '<a:font script="Hebr" typeface="Times New Roman"/>' ; 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="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" type
39 : "SORT" , 40 : "DATA.SERIES" , 41 : "TABLE" , 42 : "FORMAT.NUMBER" , 43 : "ALIGNMENT" , 44 : "STYLE" , 45 : "BORDER" , 46 : "CELL.PROTECTION" , 47 : "COLUMN.WIDTH" , 48 : "UNDO" , 49 : "CUT" , 50 : "COPY" , 51 : "PASTE" , 52 : "CLEAR" , 53 : "PASTE.SPECIAL" , 54 : "EDIT.DELETE" , 55 : "INSERT" , 56 : "FILL.RIGHT" , 57 : "FILL.DOWN" , 61 : "DEFINE.NAME" , 62 : "CREATE.NAMES" , 63 : "FORMULA.GOTO" , 64 : "FORMULA.FIND" , 65 : "SELECT.LAST.CELL" , 66 : "SHOW.ACTIVE.CELL" , 67 : "GALLERY.AREA" , 68 : "GALLERY.BAR" , 69 : "GALLERY.COLUMN" , 70 : "GALLERY.LINE" , 71 : "GALLERY.PIE" , 72 : "GALLERY.SCATTER" , 73 : "COMBINATION" , 74 : "PREFERRED" , 75 : "ADD.OVERLAY" , 76 : "GRIDLINES" , 77 : "SET.PREFERRED" , 78 : "AXES" , 79 : "LEGEND" , 80 : "ATTACH.TEXT" , 81 : "ADD.ARROW" , 82 : "SELECT.CHART" , 83 : "SELECT.PLOT.AREA" , 84 : "PATTERNS" , 85 : "MAIN.CHART" , 86 : "OVERLAY" , 87 : "SCALE" , 88 : "FORMAT.LEGEND" , 89 : "FORMAT.TEXT" , 90 : "EDIT.REPEAT" , 91 : "PARSE" , 92 : "JUSTIFY" , 93 : "HIDE" , 94 : "UNHIDE" , 95 : "WORKSPACE" , 96 : "FORMULA" , 97 : "FORMULA.FILL" , 98 : "FORMULA.ARRAY" , 99 : "DATA.FIND.NEXT" , 100 : "DATA.FIND.PREV" , 101 : "FORMULA.FIND.NEXT" , 102 : "FORMULA.FIND.PREV" , 103 : "ACTIVATE" , 104 : "ACTIVATE.NEXT" , 105 : "ACTIVATE.PREV" , 106 : "UNLOCKED.NEXT" , 107 : "UNLOCKED.PREV" , 108 : "COPY.PICTURE" , 109 : "SELECT" , 110 : "DELETE.NAME" , 111 : "DELETE.FORMAT" , 112 : "VLINE" , 113 : "HLINE" , 114 : "VPAGE" , 115 : "HPAGE" , 116 : "VSCROLL" , 117 : "HSCROLL" , 118 : "ALERT" , 119 : "NEW" , 120 : "CANCEL.COPY" , 121 : "SHOW.CLIPBOARD" , 122 : "MESSAGE" , 124 : "PASTE.LINK" , 125 : "APP.ACTIVATE" , 126 : "DELETE.ARROW" , 127 : "ROW.HEIGHT" , 128 : "FORMAT.MOVE" , 129 : "FORMAT.SIZE" , 130 : "FORMULA.REPLACE" , 131 : "SEND.KEYS" , 132 : "SELECT.SPECIAL" , 133 : "APPLY.NAMES" , 134 : "REPLACE.FONT" , 135 : "FREEZE.PANES" , 136 : "SHOW.INFO" , 137 : "SPLIT" , 138 : "ON.WINDOW" , 139 : "ON.DATA" , 140 : "DISABLE.INPUT" , 142 : "OUTLINE" , 143 : "LIST.NAMES" , 144 : "FILE.CLOSE" , 145 : "SAVE.WORKBOOK" , 146 : "DATA.FORM" , 147 : "COPY.CHART" , 148 : "ON.TIME" , 149 : "WAIT" , 150 : "FORMAT.FONT" , 151 : "FILL.UP" , 152 : "FILL.LEFT" , 153 : "DELETE.OVERLAY" , 155 : "SHORT.MENUS" , 159 : "SET.UPDATE.STATUS" , 161 : "COLOR.PALETTE" , 162 : "DELETE.STYLE" , 163 : "WINDOW.RESTORE" , 164 : "WINDOW.MAXIMIZE" , 166 : "CHANGE.LINK" , 167 : "CALCULATE.DOCUMENT" , 168 : "ON.KEY" , 169 : "APP.RESTORE" , 170 : "APP.MOVE" , 171 : "APP.SIZE" , 172 : "APP.MINIMIZE" , 173 : "APP.MAXIMIZE" , 174 : "BRING.TO.FRONT" , 175 : "SEND.TO.BACK" , 185 : "MAIN.CHART.TYPE" , 186 : "OVERLAY.CHART.TYPE" , 187 : "SELECT.END" , 188 : "OPEN.MAIL" , 189 : "SEND.MAIL" , 190 : "STANDARD.FONT" , 191 : "CONSOLIDATE" , 192 : "SORT.SPECIAL" , 193 : "GALLERY.3D.AREA" , 194 : "GALLERY.3D.COLUMN" , 195 : "GALLERY.3D.LINE" , 196 : "GALLERY.3D.PIE" , 197 : "VIEW.3D" , 198 : "GOAL.SEEK" , 199 : "WORKGROUP" , 200 : "FILL.GROUP" , 201 : "UPDATE.LINK" , 202 : "PROMOTE" , 203 : "DEMOTE" , 204 : "SHOW.DETAIL" , 206 : "UNGROUP" , 207 : "OBJECT.PROPERTIES" , 208 : "SAVE.NEW.OBJECT" , 209 : "SHARE" , 210 : "SHARE.NAME" , 211 : "DUPLICATE" , 212 : "APPLY.STYLE" , 213 : "ASSIGN.TO.OBJECT" , 214 : "OBJECT.PROTECTION" , 215 : "HIDE.OBJECT" , 216 : "SET.EXTRACT" , 217 : "CREATE.PUBLISHER" , 218 : "SUBSCRIBE.TO" , 219 : "ATTRIBUTES" , 220 : "SHOW.TOOLBAR" , 222 : "PRINT.PREVIEW" , 223 : "EDIT.COLOR" , 224 : "SHOW.LEVELS" , 225 : "FORMAT.MAIN" , 226 : "FORMAT.OVERLAY" , 227 : "ON.RECALC" , 228 : "EDIT.SERIES" , 229 : "DEFINE.STYLE" , 240 : "LINE.PRINT" , 243 : "ENTER.DATA" , 249 : "GALLERY.RADAR" , 250 : "MERGE.STYLES" , 251 : "EDITION.OPTIONS" , 252 : "PASTE.PICTURE" , 253 : "PASTE.PICTURE.LINK" , 254 : "SPELLING" , 256 : "ZOOM" , 259 : "INSERT.OBJECT" , 260 : "WINDOW.MINIMIZE" , 265 : "SOUND.NOTE" , 266 : "SOUND.PLAY" , 267 : "FORMAT.SHAPE" , 268 : "EXTEND.POLYGON" , 269 : "FORMAT.AUTO" , 272 : "GALLERY.3D.BAR" , 273 : "GALLERY.3D.SURFACE" , 274 : "FILL.AUTO" , 276 : "CUSTOMIZE.TOOLBAR" , 277 : "ADD.TOOL" , 278 : "EDIT.OBJECT" , 279 : "ON.DOUBLECLICK" , 280 : "ON.ENTRY" , 281 : "WORKBOOK.ADD" , 282 : "WORKBOOK.MOVE" , 283 : "WORKBOOK.COPY" , 284 : "WORKBOOK.OPTIONS" , 285 : "SAVE.WORKSPACE" , 288 : "CHART.WIZARD" , 289 : "DELETE.TOOL" , 290 : "MOVE.TOOL" , 291 : "WORKBOOK.SELECT" , 292 : "WORKBOOK.ACTIVATE" , 293 : "ASSIGN.TO.TOOL" , 295 : "COPY.TOOL" , 296 : "RESET.TOOL" , 297 : "CONSTRAIN.NUMERIC" , 298 : "PASTE.TOOL" , 302 : "WORKBOOK.NEW" , 305 : "SCENARIO.CELLS" , 306 : "SCENARIO.DELETE" , 307 : "SCENARIO.ADD" , 308 : "SCENARIO.EDIT" , 309 : "SCENARIO.SHOW" , 310 : "SCENARIO.SHOW.NEXT" , 311 : "SCENARIO.SUMMARY" , 312 : "PIVOT.TABLE.WIZARD" , 313 : "PIVOT.FIELD.PROPERTIES" , 314 : "PIVOT.FIELD" , 315 : "PIVOT.ITEM" , 316 : "PIVOT.ADD.FIELDS" , 318 : "OPTIONS.CALCULATION" , 319 : "OPTIONS.EDIT" , 320 : "OPTIONS.VIEW" , 321 : "ADDIN.MANAGER" , 322 : "MENU.EDITOR" , 323 : "ATTACH.TOOLBARS" , 324 : "VBAActivate" , 325 : "OPTIONS.CHART" , 328 : " VBA .
break ; case "BrtPageSetup" : break ; case "BrtFRTBegin" : pass = true ; break ; case "BrtFRTEnd" : pass = false ; break ; case "BrtEndSheet" : break ; case "BrtDrawing" : break ; case "BrtLegacyDrawing" : break ; case "BrtLegacyDrawingHF" : break ; case "BrtPhoneticInfo" : break ; case "BrtBeginHeaderFooter" : break ; case "BrtEndHeaderFooter" : break ; case "BrtBrk" : break ; case "BrtBeginRwBrk" : break ; case "BrtEndRwBrk" : break ; case "BrtBeginColBrk" : break ; case "BrtEndColBrk" : break ; case "BrtBeginUserShViews" : break ; case "BrtBeginUserShView" : break ; case "BrtEndUserShView" : break ; case "BrtEndUserShViews" : break ; case "BrtBkHim" : break ; case "BrtBeginOleObjects" : break ; case "BrtOleObject" : break ; case "BrtEndOleObjects" : break ; case "BrtBeginListParts" : break ; case "BrtListPart" : break ; case "BrtEndListParts" : break ; case "BrtBeginSortState" : break ; case "BrtBeginSortCond" : break ; case "BrtEndSortCond" : break ; case "BrtEndSortState" : break ; case "BrtBeginConditionalFormatting" : break ; case "BrtEndConditionalFormatting" : break ; case "BrtBeginCFRule" : break ; case "BrtEndCFRule" : break ; case "BrtBeginDVals" : break ; case "BrtDVal" : break ; case "BrtEndDVals" : break ; case "BrtRangeProtection" : break ; case "BrtBeginDCon" : break ; case "BrtEndDCon" : break ; case "BrtBeginDRefs" : break ; case "BrtDRef" : break ; case "BrtEndDRefs" : break ; case "BrtBeginActiveXControls" : break ; case "BrtActiveX" : break ; case "BrtEndActiveXControls" : break ; case "BrtBeginAFilter" : break ; case "BrtEndAFilter" : break ; case "BrtBeginFilterColumn" : break ; case "BrtBeginFilters" : break ; case "BrtFilter" : break ; case "BrtEndFilters" : break ; case "BrtEndFilterColumn" : break ; case "BrtDynamicFilter" : break ; case "BrtTop10Filter" : break ; case "BrtBeginCustomFilters" : break ; case "BrtCustomFilter" : break ; case "BrtEndCustomFilters" : break ; case "BrtBeginSmartTags" : break ; case "BrtBeginCellSmartTags" : break ; case "BrtBeginCellSmartTag" : break ; case "BrtCellSmartTagProperty" : break ; case "BrtEndCellSmartTag" : break ; case "BrtEndCellSmartTags" : break ; case "BrtEndSmartTags" : break ; case "BrtBeginCellWatches" : break ; case "BrtCellWatch" : break ; case "BrtEndCellWatches" : break ; case "BrtTable" : break ; case "BrtBeginCellIgnoreECs" : break ; case "BrtCellIgnoreEC" : break ; case "BrtEndCellIgnoreECs" : break ; default : if ( ! pass || opts . WTF ) throw new Error ( "Unexpected record " + Record . n ) } } , opts ) ; if ( ! s [ "!ref" ] && ( refguess . s . r < 2e6 || ref && ( ref . e . r > 0 || ref . e . c > 0 || ref . s . r > 0 || ref . s . c > 0 ) ) ) s [ "!ref" ] = encode _range ( ref || refguess ) ; if ( opts . sheetRows && s [ "!ref" ] ) { var tmpref = safe _decode _range ( s [ "!ref" ] ) ; if ( opts . sheetRows < + tmpref . e . r ) { tmpref . e . r = opts . sheetRows - 1 ; if ( tmpref . e . r > refguess . e . r ) tmpref . e . r = refguess . e . r ; if ( tmpref . e . r < tmpref . s . r ) tmpref . s . r = tmpref . e . r ; if ( tmpref . e . c > refguess . e . c ) tmpref . e . c = refguess . e . c ; if ( tmpref . e . c < tmpref . s . c ) tmpref . s . c = tmpref . e . c ; s [ "!fullref" ] = s [ "!ref" ] ; s [ "!ref" ] = encode _range ( tmpref ) } } if ( mergecells . length > 0 ) s [ "!merges" ] = mergecells ; return s } function write _ws _bin _cell ( ba , cell , R , C , opts ) { if ( cell . v === undefined ) return "" ; var vv = "" ; switch ( cell . t ) { case "b" : vv = cell . v ? "1" : "0" ; break ; case "n" : case "e" : vv = "" + cell . v ; break ; default : vv = cell . v ; break } var o = { r : R , c : C } ; o . s = get _cell _style ( opts . cellXfs , cell , opts ) ; switch ( cell . t ) { case "s" : case "str" : if ( opts . bookSST ) { vv = get _sst _id ( opts . Strings , cell . v ) ; o . t = "s" ; o . v = vv ; write _record ( ba , "BrtCellIsst" , write _BrtCellIsst ( cell , o ) ) } else { o . t = "str" ; write _record ( ba , "BrtCellSt" , write _BrtCellSt ( cell , o ) ) } return ; case "n" : if ( cell . v == ( cell . v | 0 ) && cell . v > - 1e3 && cell . v < 1e3 ) write _record ( ba , "BrtCellRk" , write _BrtCellRk ( cell , o ) ) ; else write _record ( ba , "BrtCellReal" , write _BrtCellReal ( cell , o ) ) ; return ; case "b" : o . t = "b" ; write _record ( ba , "BrtCellBool" , write _BrtCellBool ( cell , o ) ) ; return ; case "e" : o . t = "e" ; break } write _record ( ba , "BrtCellBlank" , write _BrtCellBlank ( cell , o ) ) } function write _CELLTABLE ( ba , ws , idx , opts , wb ) { var range = safe _decode _range ( ws [ "!ref" ] || "A1" ) , ref , rr = "" , cols = [ ] ; write _record ( ba , "BrtBeginSheetData" ) ; for ( var R = range . s . r ; R <= range . e . r ; ++ R ) { rr = encode _row ( R ) ; write _row _header ( ba , ws , range , R ) ; for ( var C = range . s . c ; C <= range . e . c ; ++ C ) { if ( R === range . s . r ) cols [ C ] = encode _col ( C ) ; ref = cols [ C ] + rr ; if ( ! ws [ ref ] ) continue ; write _ws _bin _cell ( ba , ws [ ref ] , R , C , opts ) } } write _record ( ba , "BrtEndSheetData" ) } function write _ws _bin ( idx , opts , wb ) { var ba = buf _array ( ) ; var s = wb . SheetNames [ idx ] , ws = wb . Sheets [ s ] || { } ; var r = safe _decode _range ( ws [ "!ref" ] || "A1" ) ; write _record (
date1904 : date1904 || false } ) ; if ( opts . cellNF ) p . z = SSF . _table [ fmtid ] } catch ( e ) { if ( opts . WTF ) throw e } } function make _cell ( val , ixfe , t ) { return { v : val , ixfe : ixfe , t : t } } function parse _workbook ( blob , options ) { var wb = { opts : { } } ; var Sheets = { } ; var out = { } ; var Directory = { } ; var found _sheet = false ; var range = { } ; var last _formula = null ; var sst = [ ] ; var cur _sheet = "" ; var Preamble = { } ; var lastcell , last _cell , cc , cmnt , rng , rngC , rngR ; var shared _formulae = { } ; var array _formulae = [ ] ; var temp _val ; var country ; var cell _valid = true ; var XFs = [ ] ; var palette = [ ] ; var get _rgb = function getrgb ( icv ) { if ( icv < 8 ) return XLSIcv [ icv ] ; if ( icv < 64 ) return palette [ icv - 8 ] || XLSIcv [ icv ] ; return XLSIcv [ icv ] } ; var process _cell _style = function pcs ( cell , line ) { var xfd = line . XF . data ; if ( ! xfd || ! xfd . patternType ) return ; line . s = { } ; line . s . patternType = xfd . patternType ; var t ; if ( t = rgb2Hex ( get _rgb ( xfd . icvFore ) ) ) { line . s . fgColor = { rgb : t } } if ( t = rgb2Hex ( get _rgb ( xfd . icvBack ) ) ) { line . s . bgColor = { rgb : t } } } ; var addcell = function addcell ( cell , line , options ) { if ( ! cell _valid ) return ; if ( options . cellStyles && line . XF && line . XF . data ) process _cell _style ( cell , line ) ; lastcell = cell ; last _cell = encode _cell ( cell ) ; if ( range . s ) { if ( cell . r < range . s . r ) range . s . r = cell . r ; if ( cell . c < range . s . c ) range . s . c = cell . c } if ( range . e ) { if ( cell . r + 1 > range . e . r ) range . e . r = cell . r + 1 ; if ( cell . c + 1 > range . e . c ) range . e . c = cell . c + 1 } if ( options . sheetRows && lastcell . r >= options . sheetRows ) cell _valid = false ; else out [ last _cell ] = line } ; var opts = { enc : false , sbcch : 0 , snames : [ ] , sharedf : shared _formulae , arrayf : array _formulae , rrtabid : [ ] , lastuser : "" , biff : 8 , codepage : 0 , winlocked : 0 , wtf : false } ; if ( options . password ) opts . password = options . password ; var mergecells = [ ] ; var objects = [ ] ; var supbooks = [ [ ] ] ; var sbc = 0 , sbci = 0 , sbcli = 0 ; supbooks . SheetNames = opts . snames ; supbooks . sharedf = opts . sharedf ; supbooks . arrayf = opts . arrayf ; var last _Rn = "" ; var file _depth = 0 ; var BIFF2Fmt = 0 ; opts . codepage = 1200 ; set _cp ( 1200 ) ; while ( blob . l < blob . length - 1 ) { var s = blob . l ; var RecordType = blob . read _shift ( 2 ) ; if ( RecordType === 0 && last _Rn === "EOF" ) break ; var length = blob . l === blob . length ? 0 : blob . read _shift ( 2 ) , y ; var R = XLSRecordEnum [ RecordType ] ; if ( R && R . f ) { if ( options . bookSheets ) { if ( last _Rn === "BoundSheet8" && R . n !== "BoundSheet8" ) break } last _Rn = R . n ; if ( R . r === 2 || R . r == 12 ) { var rt = blob . read _shift ( 2 ) ; length -= 2 ; if ( ! opts . enc && rt !== RecordType ) throw "rt mismatch" ; if ( R . r == 12 ) { blob . l += 10 ; length -= 10 } } var val ; if ( R . n === "EOF" ) val = R . f ( blob , length , opts ) ; else val = slurp ( R , blob , length , opts ) ; var Rn = R . n ; switch ( Rn ) { case "Date1904" : wb . opts . Date1904 = val ; break ; case "WriteProtect" : wb . opts . WriteProtect = true ; break ; case "FilePass" : if ( ! opts . enc ) blob . l = 0 ; opts . enc = val ; if ( opts . WTF ) console . error ( val ) ; if ( ! options . password ) throw new Error ( "File is password-protected" ) ; if ( val . Type !== 0 ) throw new Error ( "Encryption scheme unsupported" ) ; if ( ! val . valid ) throw new Error ( "Password is incorrect" ) ; break ; case "WriteAccess" : opts . lastuser = val ; break ; case "FileSharing" : break ; case "CodePage" : if ( val === 21010 ) val = 1200 ; else if ( val === 32769 ) val = 1252 ; opts . codepage = val ; set _cp ( val ) ; break ; case "RRTabId" : opts . rrtabid = val ; break ; case "WinProtect" : opts . winlocked = val ; break ; case "Template" : break ; case "RefreshAll" : wb . opts . RefreshAll = val ; break ; case "BookBool" : break ; case "UsesELFs" : break ; case "MTRSettings" : { if ( val [ 0 ] && val [ 1 ] ) throw "Unsupported threads: " + val } break ; case "CalcCount" : wb . opts . CalcCount = val ; break ; case "CalcDelta" : wb . opts . CalcDelta = val ; break ; case "CalcIter" : wb . opts . CalcIter = val ; break ; case "CalcMode" : wb . opts . CalcMode = val ; break ; case "CalcPrecision" : 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" : bre
n : "BrtPhoneticInfo" , f : parsenoop } , 538 : { n : "BrtBeginECTxtWiz" , f : parsenoop } , 539 : { n : "BrtEndECTxtWiz" , f : parsenoop } , 540 : { n : "BrtBeginECTWFldInfoLst" , f : parsenoop } , 541 : { n : "BrtEndECTWFldInfoLst" , f : parsenoop } , 542 : { n : "BrtBeginECTwFldInfo" , f : parsenoop } , 548 : { n : "BrtFileSharing" , f : parsenoop } , 549 : { n : "BrtOleSize" , f : parsenoop } , 550 : { n : "BrtDrawing" , f : parsenoop } , 551 : { n : "BrtLegacyDrawing" , f : parsenoop } , 552 : { n : "BrtLegacyDrawingHF" , f : parsenoop } , 553 : { n : "BrtWebOpt" , f : parsenoop } , 554 : { n : "BrtBeginWebPubItems" , f : parsenoop } , 555 : { n : "BrtEndWebPubItems" , f : parsenoop } , 556 : { n : "BrtBeginWebPubItem" , f : parsenoop } , 557 : { n : "BrtEndWebPubItem" , f : parsenoop } , 558 : { n : "BrtBeginSXCondFmt" , f : parsenoop } , 559 : { n : "BrtEndSXCondFmt" , f : parsenoop } , 560 : { n : "BrtBeginSXCondFmts" , f : parsenoop } , 561 : { n : "BrtEndSXCondFmts" , f : parsenoop } , 562 : { n : "BrtBkHim" , f : parsenoop } , 564 : { n : "BrtColor" , f : parsenoop } , 565 : { n : "BrtBeginIndexedColors" , f : parsenoop } , 566 : { n : "BrtEndIndexedColors" , f : parsenoop } , 569 : { n : "BrtBeginMRUColors" , f : parsenoop } , 570 : { n : "BrtEndMRUColors" , f : parsenoop } , 572 : { n : "BrtMRUColor" , f : parsenoop } , 573 : { n : "BrtBeginDVals" , f : parsenoop } , 574 : { n : "BrtEndDVals" , f : parsenoop } , 577 : { n : "BrtSupNameStart" , f : parsenoop } , 578 : { n : "BrtSupNameValueStart" , f : parsenoop } , 579 : { n : "BrtSupNameValueEnd" , f : parsenoop } , 580 : { n : "BrtSupNameNum" , f : parsenoop } , 581 : { n : "BrtSupNameErr" , f : parsenoop } , 582 : { n : "BrtSupNameSt" , f : parsenoop } , 583 : { n : "BrtSupNameNil" , f : parsenoop } , 584 : { n : "BrtSupNameBool" , f : parsenoop } , 585 : { n : "BrtSupNameFmla" , f : parsenoop } , 586 : { n : "BrtSupNameBits" , f : parsenoop } , 587 : { n : "BrtSupNameEnd" , f : parsenoop } , 588 : { n : "BrtEndSupBook" , f : parsenoop } , 589 : { n : "BrtCellSmartTagProperty" , f : parsenoop } , 590 : { n : "BrtBeginCellSmartTag" , f : parsenoop } , 591 : { n : "BrtEndCellSmartTag" , f : parsenoop } , 592 : { n : "BrtBeginCellSmartTags" , 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 :
if ( typeof ODS === "undefined" || ! ODS . parse _ods ) throw new Error ( "Unsupported ODS" ) ; return ODS . parse _ods ( zip , opts ) } function write _ods ( wb , opts ) { if ( typeof module !== "undefined" && typeof require !== "undefined" && typeof ODS === "undefined" ) ODS = require ( "./od" + "s" ) ; if ( typeof ODS === "undefined" || ! ODS . write _ods ) throw new Error ( "Unsupported ODS" ) ; return ODS . write _ods ( wb , opts ) } function fix _opts _func ( defaults ) { return function fix _opts ( opts ) { for ( var i = 0 ; i != defaults . length ; ++ i ) { var d = defaults [ i ] ; if ( opts [ d [ 0 ] ] === undefined ) opts [ d [ 0 ] ] = d [ 1 ] ; if ( d [ 2 ] === "n" ) opts [ d [ 0 ] ] = Number ( opts [ d [ 0 ] ] ) } } } var fix _read _opts = fix _opts _func ( [ [ "cellNF" , false ] , [ "cellHTML" , true ] , [ "cellFormula" , true ] , [ "cellStyles" , false ] , [ "cellDates" , false ] , [ "sheetStubs" , false ] , [ "sheetRows" , 0 , "n" ] , [ "bookDeps" , false ] , [ "bookSheets" , false ] , [ "bookProps" , false ] , [ "bookFiles" , false ] , [ "bookVBA" , false ] , [ "password" , "" ] , [ "WTF" , false ] ] ) ; var fix _write _opts = fix _opts _func ( [ [ "cellDates" , false ] , [ "bookSST" , false ] , [ "bookType" , "xlsx" ] , [ "compression" , false ] , [ "WTF" , false ] ] ) ; function safe _parse _wbrels ( wbrels , sheets ) { if ( ! wbrels ) return 0 ; try { wbrels = sheets . map ( function pwbr ( w ) { return [ w . name , wbrels [ "!id" ] [ w . id ] . Target ] } ) } catch ( e ) { return null } return ! wbrels || wbrels . length === 0 ? null : wbrels } function safe _parse _ws ( zip , path , relsPath , sheet , sheetRels , sheets , opts ) { try { sheetRels [ sheet ] = parse _rels ( getzipstr ( zip , relsPath , true ) , path ) ; sheets [ sheet ] = parse _ws ( getzipdata ( zip , path ) , path , opts , sheetRels [ sheet ] ) } catch ( e ) { if ( opts . WTF ) throw e } } var nodirs = function nodirs ( x ) { return x . substr ( - 1 ) != "/" } ; function parse _zip ( zip , opts ) { make _ssf ( SSF ) ; opts = opts || { } ; fix _read _opts ( opts ) ; reset _cp ( ) ; if ( safegetzipfile ( zip , "META-INF/manifest.xml" ) ) return parse _ods ( zip , opts ) ; var entries = keys ( zip . files ) . filter ( nodirs ) . sort ( ) ; var dir = parse _ct ( getzipstr ( zip , "[Content_Types].xml" ) , opts ) ; var xlsb = false ; var sheets , binname ; if ( dir . workbooks . length === 0 ) { binname = "xl/workbook.xml" ; if ( getzipdata ( zip , binname , true ) ) dir . workbooks . push ( binname ) } if ( dir . workbooks . length === 0 ) { binname = "xl/workbook.bin" ; if ( ! getzipfile ( zip , binname , true ) ) throw new Error ( "Could not find workbook" ) ; dir . workbooks . push ( binname ) ; xlsb = true } if ( dir . workbooks [ 0 ] . substr ( - 3 ) == "bin" ) xlsb = true ; if ( xlsb ) set _cp ( 1200 ) ; if ( ! opts . bookSheets && ! opts . bookProps ) { strs = [ ] ; if ( dir . sst ) strs = parse _sst ( getzipdata ( zip , dir . sst . replace ( /^\// , "" ) ) , dir . sst , opts ) ; styles = { } ; if ( dir . style ) styles = parse _sty ( getzipdata ( zip , dir . style . replace ( /^\// , "" ) ) , dir . style , opts ) ; themes = { } ; if ( opts . cellStyles && dir . themes . length ) themes = parse _theme ( getzipdata ( zip , dir . themes [ 0 ] . replace ( /^\// , "" ) , true ) , dir . themes [ 0 ] , opts ) } var wb = parse _wb ( getzipdata ( zip , dir . workbooks [ 0 ] . replace ( /^\// , "" ) ) , dir . workbooks [ 0 ] , opts ) ; var props = { } , propdata = "" ; if ( dir . coreprops . length !== 0 ) { propdata = getzipstr ( zip , dir . coreprops [ 0 ] . replace ( /^\// , "" ) , true ) ; if ( propdata ) props = parse _core _props ( propdata ) ; if ( dir . extprops . length !== 0 ) { propdata = getzipstr ( zip , dir . extprops [ 0 ] . replace ( /^\// , "" ) , true ) ; if ( propdata ) parse _ext _props ( propdata , props ) } } var custprops = { } ; if ( ! opts . bookSheets || opts . bookProps ) { if ( dir . custprops . length !== 0 ) { propdata = getzipstr ( zip , dir . custprops [ 0 ] . replace ( /^\// , "" ) , true ) ; if ( propdata ) custprops = parse _cust _props ( propdata , opts ) } } var out = { } ; if ( opts . bookSheets || opts . bookProps ) { if ( props . Worksheets && props . SheetNames . length > 0 ) sheets = props . SheetNames ; else if ( wb . Sheets ) sheets = wb . Sheets . map ( function pluck ( x ) { return x . name } ) ; if ( opts . bookProps ) { out . Props = props ; out . Custprops = custprops } if ( typeof sheets !== "undefined" ) out . SheetNames = sheets ; if ( opts . bookSheets ? out . SheetNames : opts . bookProps ) return out } sheets = { } ; var deps = { } ; if ( opts . bookDeps && dir . calcchain ) deps = parse _cc ( getzipdata ( zip , dir . calcchain . replace ( /^\// , "" ) ) , dir . calcchain , opts ) ; var i = 0 ; var sheetRels = { } ; var path , relsPath ; if ( ! props . Worksheets ) { var wbsheets = wb . Sheets ; props . Worksheets = wbsheets . length ; props . SheetNames = [ ] ; for ( var j = 0 ; j != wbsheets . length ; ++ j ) { props . SheetNames [ j ] = wbsheets [ j ] . name } } var wbext = xlsb ? "bin" : "xml" ; var wbrelsfile = "xl/_rels/workbook." + wbext + ".rels" ; var wbrels = parse _rels ( getzipstr ( zip , wbrelsfile , true ) , wbrelsfile ) ; if ( wbrels ) wbrels = safe _parse _wbrels ( wbrels , wb . Sheets ) ; var nmode = getzipdata ( zip , "xl/worksheets/sheet.xml" , true ) ? 1 : 0 ; for ( i =