2014-02-17 08:44:22 +00:00
/* xlsx.js (C) 2013-2014 SheetJS -- http://sheetjs.com */
2014-06-29 18:29:45 +00:00
var XLSX = { } ; ( function ( XLSX ) { XLSX . version = "0.7.7" ; var current _codepage = 1252 , 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 ( 1252 ) } function set _cp ( cp ) { current _codepage = cp ; if ( typeof cptable !== "undefined" ) current _cptable = cptable [ cp ] } function char _codes ( data ) { var o = [ ] ; for ( var i = 0 ; i != data . length ; ++ i ) o [ i ] = data . charCodeAt ( i ) ; return o } function debom _xml ( data ) { if ( typeof cptable !== "undefined" ) { if ( data . charCodeAt ( 0 ) === 255 && data . charCodeAt ( 1 ) === 254 ) { return cptable . utils . decode ( 1200 , char _codes ( data . substr ( 2 ) ) ) } } return data } 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" , "June" ] , [ "J" , "Jul" , "July" ] , [ "A" , "Aug" , "August" ] , [ "S" , "Sep" , "September" ] , [ "O" , "Oct" , "October" ] , [ "N" , "Nov" , "November" ] , [ "D" , "Dec" , "December" ] ] ; function frac ( x , D , mixed ) { var sgn = x < 0 ? - 1 : 1 ; var B = x * sgn ; var P _2 = 0 , P _1 = 1 , P = 0 ; var Q _2 = 1 , Q _1 = 0 , Q = 0 ; var A = Math . floor ( B ) ; while ( Q _1 < D ) { A = Math . floor ( B ) ; P = A * P _1 + P _2 ; Q = A * Q _1 + Q _2 ; if ( B - A < 5e-10 ) break ; B = 1 / ( B - A ) ; P _2 = P _1 ; P _1 = P ; Q _2 = Q _1 ; Q _1 = Q } if ( Q > D ) { Q = Q _1 ; P = P _1 } if ( Q > D ) { Q = Q _2 ; P = P _2 } if ( ! mixed ) return [ 0 , sgn * P , Q ] ; if ( Q === 0 ) throw "Unexpected state: " + P + " " + P _1 + " " + P _2 + " " + Q + " " + Q _1 + " " + Q _2 ; var q = Math . floor ( sgn * P / Q ) ; return [ q , sgn * P - q * Q , Q ] } function general _fmt _int ( v , opts ) { return "" + v } SSF . _general _int = general _fmt _int ; var general _fmt _num = function make _general _fmt _num ( ) { var gnr1 = /\.(\d*[1-9])0+$/ , gnr2 = /\.0*$/ , gnr4 = /\.(\d*[1-9])0+/ , gnr5 = /\.0*[Ee]/ , gnr6 = /(E[+-])(\d)$/ ; function gfn2 ( v ) { var w = v < 0 ? 12 : 11 ; var o = gfn5 ( v . toFixed ( 12 ) ) ; if ( o . length <= w ) return o ; o = v . toPrecision ( 10 ) ; if ( o . length <= w ) return o ; return v . toExponential ( 5 ) } function gfn3 ( v ) { var o = v . toFixed ( 11 ) . replace ( gnr1 , ".$1" ) ; if ( o . length > ( v < 0 ? 12 : 11 ) ) o = v . toPrecision ( 6 ) ; return o } function gfn4 ( o ) { for ( var i = 0 ; i != o . length ; ++ i ) if ( ( o . charCodeAt ( i ) | 32 ) === 101 ) return o . replace ( gnr4 , ".$1" ) . replace ( gnr5 , "E" ) . replace ( "e" , "E" ) . replace ( gnr6 , "$10$2" ) ; return o } function gfn5 ( o ) { return o . indexOf ( "." ) > - 1 ? o . replace ( gnr2 , "" ) . replace ( gnr1 , ".$1" ) : o } return function general _fmt _num ( v , opts ) { var V = Math . floor ( Math . log ( Math . abs ( v ) ) * Math . LOG10E ) , o ; if ( V >= - 4 && V <= - 1 ) o = v . toPrecision ( 10 + V ) ; else if ( Math . abs ( V ) <= 9 ) o = gfn2 ( v ) ; else if ( V === 10 ) o = v . toFixed ( 10 ) . substr ( 0 , 12 ) ; else o = gfn3 ( v )
throw new Error ( "Unable to serialize " + s ) } var XML _HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n' ; var XMLNS = { dc : "http://purl.org/dc/elements/1.1/" , dcterms : "http://purl.org/dc/terms/" , dcmitype : "http://purl.org/dc/dcmitype/" , mx : "http://schemas.microsoft.com/office/mac/excel/2008/main" , r : "http://schemas.openxmlformats.org/officeDocument/2006/relationships" , sjs : "http://schemas.openxmlformats.org/package/2006/sheetjs/core-properties" , vt : "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" , xsi : "http://www.w3.org/2001/XMLSchema-instance" , xsd : "http://www.w3.org/2001/XMLSchema" } ; XMLNS . main = [ "http://schemas.openxmlformats.org/spreadsheetml/2006/main" , "http://purl.oclc.org/ooxml/spreadsheetml/main" , "http://schemas.microsoft.com/office/excel/2006/main" , "http://schemas.microsoft.com/office/excel/2006/2" ] ; function readIEEE754 ( buf , idx , isLE , nl , ml ) { if ( isLE === undefined ) isLE = true ; if ( ! nl ) nl = 8 ; if ( ! ml && nl === 8 ) ml = 52 ; var e , m , el = nl * 8 - ml - 1 , eMax = ( 1 << el ) - 1 , eBias = eMax >> 1 ; var bits = - 7 , d = isLE ? - 1 : 1 , i = isLE ? nl - 1 : 0 , s = buf [ idx + i ] ; i += d ; e = s & ( 1 << - bits ) - 1 ; s >>>= - bits ; bits += el ; for ( ; bits > 0 ; e = e * 256 + buf [ idx + i ] , i += d , bits -= 8 ) ; m = e & ( 1 << - bits ) - 1 ; e >>>= - bits ; bits += ml ; for ( ; bits > 0 ; m = m * 256 + buf [ idx + i ] , i += d , bits -= 8 ) ; if ( e === eMax ) return m ? NaN : ( s ? - 1 : 1 ) * Infinity ; else if ( e === 0 ) e = 1 - eBias ; else { m = m + Math . pow ( 2 , ml ) ; e = e - eBias } return ( s ? - 1 : 1 ) * m * Math . pow ( 2 , e - ml ) } var _ _toBuffer , _ _ _toBuffer ; _ _toBuffer = _ _ _toBuffer = function ( bufs ) { var x = [ ] ; for ( var i = 0 ; i != bufs [ 0 ] . length ; ++ i ) { x = x . concat ( bufs [ 0 ] [ i ] ) } return x } ; if ( typeof Buffer !== "undefined" ) { _ _toBuffer = function ( bufs ) { return bufs [ 0 ] . length > 0 && Buffer . isBuffer ( bufs [ 0 ] [ 0 ] ) ? Buffer . concat ( bufs [ 0 ] ) : _ _ _toBuffer ( bufs ) } } var _ _ _readUInt32LE = function ( b , idx ) { return b . readUInt32LE ? b . readUInt32LE ( idx ) : b [ idx + 3 ] * ( 1 << 24 ) + ( b [ idx + 2 ] << 16 ) + ( b [ idx + 1 ] << 8 ) + b [ idx ] } ; var _ _ _readInt32LE = function ( b , idx ) { return ( b [ idx + 3 ] << 24 ) + ( b [ idx + 2 ] << 16 ) + ( b [ idx + 1 ] << 8 ) + b [ idx ] } ; var _ _readUInt8 = function ( b , idx ) { return b . readUInt8 ? b . readUInt8 ( idx ) : b [ idx ] } ; var _ _readUInt16LE = function ( b , idx ) { return b . readUInt16LE ? b . readUInt16LE ( idx ) : b [ idx + 1 ] * ( 1 << 8 ) + b [ idx ] } ; var _ _readInt16LE = function ( b , idx ) { var u = _ _readUInt16LE ( b , idx ) ; if ( ! ( u & 32768 ) ) return u ; return ( 65535 - u + 1 ) * - 1 } ; var _ _readUInt32LE = typeof Buffer !== "undefined" ? function ( b , i ) { return Buffer . isBuffer ( b ) ? b . readUInt32LE ( i ) : _ _ _readUInt32LE ( b , i ) } : _ _ _readUInt32LE ; var _ _readInt32LE = typeof Buffer !== "undefined" ? function ( b , i ) { return Buffer . isBuffer ( b ) ? b . readInt32LE ( i ) : _ _ _readInt32LE ( b , i ) } : _ _ _readInt32LE ; var _ _readDoubleLE = function ( b , idx ) { return b . readDoubleLE ? b . readDoubleLE ( idx ) : readIEEE754 ( b , idx || 0 ) } ; function ReadShift ( size , t ) { var o = "" , oo = [ ] , w , vv , i , loc ; if ( t === "dbcs" ) { loc = this . l ; if ( typeof Buffer !== "undefined" && this instanceof Buffer ) o = this . slice ( this . l , this . l + 2 * size ) . toString ( "utf16le" ) ; else for ( i = 0 ; i != size ; ++ i ) { o += String . fromCharCode ( _ _readUInt16LE ( this , loc ) ) ; loc += 2 } size *= 2 } else switch ( size ) { case 1 : o = _ _readUInt8 ( this , this . l ) ; break ; case 2 : o = ( t === "i" ? _ _readInt16LE : _ _readUInt16LE ) ( this , this . l ) ; break ; case 4 : o = _ _readUInt32LE ( this , this . l ) ; break ; case 8 : if ( t === "f" ) { o = _ _readDoubleLE ( this , this . l ) ; break } } this . l += size ; return o } function WriteShift ( t , val , f ) { var size , i ; if ( f === "dbcs" ) { for ( i = 0 ; i != val . length ; ++ i ) this . writeUInt16LE ( val . charCodeAt ( i ) , this . l + 2 * i ) ; size = 2 * val . length } else switch ( t ) { case 1 : size = 1 ; this . writeUInt8 ( val , this . l ) ; break ; case 4 : size = 4 ; this . writeUInt32LE ( val , this . l ) ; break ; case 8 : size = 8 ; if ( f === "f" ) { this . writeDoubleLE ( val , this . l ) ; break } case 16 : break ; case - 4 : size = 4 ; this . writeInt32LE ( val , this . l ) ; break } this . l += size ; return this } function prep _blob ( blob , pos ) { blob . l = pos || 0 ; blob . read _shift = ReadShift ; blob . write _shift = WriteShift } function parsenoop ( blob , length ) { blob . l += length } function writenoop ( blob , length ) { blob . l += length } function new _buf ( sz ) { var o = typeof Buffer !== "undefined" ? new Buffer ( sz ) : new Array ( sz ) ; prep _blob ( o , 0 ) ; return o } function is _buf ( a ) { return typeof Buffer !== "undefined" && a instanceof Buffer || Array . isArray ( a ) } function recordhopper ( data , cb , opts ) { var tmpbyte , cntbyte , length ; prep _blob ( data , data . l || 0 ) ; while ( data . l < data . length ) { var RT = data . read _shift ( 1 ) ; if ( RT & 128 ) RT = ( RT & 127 ) + ( ( data . read _shift ( 1 ) & 127 ) << 7 ) ; var R = RecordEnum [ RT ] || RecordEnum [ 6
o [ o . length ] = '<borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>' ; o [ o . length ] = '<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>' ; if ( w = write _cellXfs ( opts . cellXfs ) ) o [ o . length ] = w ; o [ o . length ] = '<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>' ; o [ o . length ] = '<dxfs count="0"/>' ; o [ o . length ] = '<tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4"/>' ; if ( o . length > 2 ) { o [ o . length ] = "</styleSheet>" ; o [ 1 ] = o [ 1 ] . replace ( "/>" , ">" ) } return o . join ( "" ) } function parse _BrtFmt ( data , length ) { var ifmt = data . read _shift ( 2 ) ; var stFmtCode = parse _XLWideString ( data , length - 2 ) ; return [ ifmt , stFmtCode ] } function parse _BrtFont ( data , length ) { var out = { flags : { } } ; out . dyHeight = data . read _shift ( 2 ) ; out . grbit = parse _FontFlags ( data , 2 ) ; out . bls = data . read _shift ( 2 ) ; out . sss = data . read _shift ( 2 ) ; out . uls = data . read _shift ( 1 ) ; out . bFamily = data . read _shift ( 1 ) ; out . bCharSet = data . read _shift ( 1 ) ; data . l ++ ; out . brtColor = parse _BrtColor ( data , 8 ) ; out . bFontScheme = data . read _shift ( 1 ) ; out . name = parse _XLWideString ( data , length - 21 ) ; out . flags . Bold = out . bls === 700 ; out . flags . Italic = out . grbit . fItalic ; out . flags . Strikeout = out . grbit . fStrikeout ; out . flags . Outline = out . grbit . fOutline ; out . flags . Shadow = out . grbit . fShadow ; out . flags . Condense = out . grbit . fCondense ; out . flags . Extend = out . grbit . fExtend ; out . flags . Sub = out . sss & 2 ; out . flags . Sup = out . sss & 1 ; return out } function parse _BrtXF ( data , length ) { var ixfeParent = data . read _shift ( 2 ) ; var ifmt = data . read _shift ( 2 ) ; parsenoop ( data , length - 4 ) ; return { ixfe : ixfeParent , ifmt : ifmt } } function parse _sty _bin ( data , opts ) { styles . NumberFmt = [ ] ; for ( var y in SSF . _table ) styles . NumberFmt [ y ] = SSF . _table [ y ] ; styles . CellXf = [ ] ; var state = "" ; var pass = false ; recordhopper ( data , function hopper _sty ( val , R , RT ) { switch ( R . n ) { case "BrtFmt" : styles . NumberFmt [ val [ 0 ] ] = val [ 1 ] ; SSF . load ( val [ 1 ] , val [ 0 ] ) ; break ; case "BrtFont" : break ; case "BrtKnownFonts" : break ; case "BrtFill" : break ; case "BrtBorder" : break ; case "BrtXF" : if ( state === "CELLXFS" ) { styles . CellXf . push ( val ) } break ; case "BrtStyle" : break ; case "BrtDXF" : break ; case "BrtMRUColor" : break ; case "BrtIndexedColor" : break ; case "BrtBeginStyleSheet" : break ; case "BrtEndStyleSheet" : break ; case "BrtBeginTableStyle" : break ; case "BrtTableStyleElement" : break ; case "BrtEndTableStyle" : break ; case "BrtBeginFmts" : state = "FMTS" ; break ; case "BrtEndFmts" : state = "" ; break ; case "BrtBeginFonts" : state = "FONTS" ; break ; case "BrtEndFonts" : state = "" ; break ; case "BrtACBegin" : state = "ACFONTS" ; break ; case "BrtACEnd" : state = "" ; break ; case "BrtBeginFills" : state = "FILLS" ; break ; case "BrtEndFills" : state = "" ; break ; case "BrtBeginBorders" : state = "BORDERS" ; break ; case "BrtEndBorders" : state = "" ; break ; case "BrtBeginCellStyleXFs" : state = "CELLSTYLEXFS" ; break ; case "BrtEndCellStyleXFs" : state = "" ; break ; case "BrtBeginCellXFs" : state = "CELLXFS" ; break ; case "BrtEndCellXFs" : state = "" ; break ; case "BrtBeginStyles" : state = "STYLES" ; break ; case "BrtEndStyles" : state = "" ; break ; case "BrtBeginDXFs" : state = "DXFS" ; break ; case "BrtEndDXFs" : state = "" ; break ; case "BrtBeginTableStyles" : state = "TABLESTYLES" ; break ; case "BrtEndTableStyles" : state = "" ; break ; case "BrtBeginColorPalette" : state = "COLORPALETTE" ; break ; case "BrtEndColorPalette" : state = "" ; break ; case "BrtBeginIndexedColors" : state = "INDEXEDCOLORS" ; break ; case "BrtEndIndexedColors" : state = "" ; break ; case "BrtBeginMRUColors" : state = "MRUCOLORS" ; break ; case "BrtEndMRUColors" : state = "" ; break ; case "BrtFRTBegin" : pass = true ; break ; case "BrtFRTEnd" : pass = false ; break ; case "BrtBeginStyleSheetExt14" : break ; case "BrtBeginSlicerStyles" : break ; case "BrtEndSlicerStyles" : break ; case "BrtBeginTimelineStylesheetExt15" : break ; case "BrtEndTimelineStylesheetExt15" : break ; case "BrtBeginTimelineStyles" : break ; case "BrtEndTimelineStyles" : break ; case "BrtEndStyleSheetExt14" : break ; default : if ( ! pass || opts . WTF ) throw new Error ( "Unexpected record " + RT + " " + R . n ) } } ) ; return styles } function write _sty _bin ( data , opts ) { } RELS . THEME = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" ; function parse _clrScheme ( t , opts ) { themes . themeElements . clrScheme = [ ] ; var color = { } ; t [ 0 ] . match ( tagregex ) . forEach ( function ( x ) { var y = parsexmltag ( x ) ; switch ( y [ 0 ] ) { case "<a:clrScheme" : case "</a:clrScheme>" : break ; case " <
return s } function write _CELLTABLE ( ba , ws , idx , opts , wb ) { var r = safe _decode _range ( ws [ "!ref" ] || "A1" ) ; write _record ( ba , "BrtBeginSheetData" ) ; for ( var i = r . s . r ; i <= r . e . r ; ++ i ) { } 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 ( ba , "BrtBeginSheet" ) ; write _record ( ba , "BrtWsDim" , write _BrtWsDim ( r ) ) ; write _CELLTABLE ( ba , ws , idx , opts , wb ) ; write _record ( ba , "BrtEndSheet" ) ; return ba . end ( ) } var WBPropsDef = [ [ "allowRefreshQuery" , "0" ] , [ "autoCompressPictures" , "1" ] , [ "backupFile" , "0" ] , [ "checkCompatibility" , "0" ] , [ "codeName" , "" ] , [ "date1904" , "0" ] , [ "dateCompatibility" , "1" ] , [ "filterPrivacy" , "0" ] , [ "hidePivotFieldList" , "0" ] , [ "promptedSolutions" , "0" ] , [ "publishItems" , "0" ] , [ "refreshAllConnections" , false ] , [ "saveExternalLinkValues" , "1" ] , [ "showBorderUnselectedTables" , "1" ] , [ "showInkAnnotation" , "1" ] , [ "showObjects" , "all" ] , [ "showPivotChartFilter" , "0" ] ] ; var WBViewDef = [ [ "activeTab" , "0" ] , [ "autoFilterDateGrouping" , "1" ] , [ "firstSheet" , "0" ] , [ "minimized" , "0" ] , [ "showHorizontalScroll" , "1" ] , [ "showSheetTabs" , "1" ] , [ "showVerticalScroll" , "1" ] , [ "tabRatio" , "600" ] , [ "visibility" , "visible" ] ] ; var SheetDef = [ [ "state" , "visible" ] ] ; var CalcPrDef = [ [ "calcCompleted" , "true" ] , [ "calcMode" , "auto" ] , [ "calcOnSave" , "true" ] , [ "concurrentCalc" , "true" ] , [ "fullCalcOnLoad" , "false" ] , [ "fullPrecision" , "true" ] , [ "iterate" , "false" ] , [ "iterateCount" , "100" ] , [ "iterateDelta" , "0.001" ] , [ "refMode" , "A1" ] ] ; var CustomWBViewDef = [ [ "autoUpdate" , "false" ] , [ "changesSavedWin" , "false" ] , [ "includeHiddenRowCol" , "true" ] , [ "includePrintSettings" , "true" ] , [ "maximized" , "false" ] , [ "minimized" , "false" ] , [ "onlySync" , "false" ] , [ "personalView" , "false" ] , [ "showComments" , "commIndicator" ] , [ "showFormulaBar" , "true" ] , [ "showHorizontalScroll" , "true" ] , [ "showObjects" , "all" ] , [ "showSheetTabs" , "true" ] , [ "showStatusbar" , "true" ] , [ "showVerticalScroll" , "true" ] , [ "tabRatio" , "600" ] , [ "xWindow" , "0" ] , [ "yWindow" , "0" ] ] ; function push _defaults _array ( target , defaults ) { for ( var j = 0 ; j != target . length ; ++ j ) { var w = target [ j ] ; for ( var i = 0 ; i != defaults . length ; ++ i ) { var z = defaults [ i ] ; if ( w [ z [ 0 ] ] == null ) w [ z [ 0 ] ] = z [ 1 ] } } } function push _defaults ( target , defaults ) { for ( var i = 0 ; i != defaults . length ; ++ i ) { var z = defaults [ i ] ; if ( target [ z [ 0 ] ] == null ) target [ z [ 0 ] ] = z [ 1 ] } } function parse _wb _defaults ( wb ) { push _defaults ( wb . WBProps , WBPropsDef ) ; push _defaults ( wb . CalcPr , CalcPrDef ) ; push _defaults _array ( wb . WBView , WBViewDef ) ; push _defaults _array ( wb . Sheets , SheetDef ) ; _ssfopts . date1904 = parsexmlbool ( wb . WBProps . date1904 , "date1904" ) } function parse _wb _xml ( data , opts ) { var wb = { AppVersion : { } , WBProps : { } , WBView : [ ] , Sheets : [ ] , CalcPr : { } , xmlns : "" } ; var pass = false , xmlns = "xmlns" ; data . match ( tagregex ) . forEach ( function xml _wb ( x ) { var y = parsexmltag ( x ) ; switch ( strip _ns ( y [ 0 ] ) ) { case "<?xml" : break ; case "<workbook" : if ( x . match ( /<\w+:workbook/ ) ) xmlns = "xmlns" + x . match ( /<(\w+):/ ) [ 1 ] ; wb . xmlns = y [ xmlns ] ; break ; case "</workbook>" : break ; case "<fileVersion" : delete y [ 0 ] ; wb . AppVersion = y ; break ; case "<fileVersion/>" : break ; case "<fileSharing" : case "<fileSharing/>" : break ; case "<workbookPr" : delete y [ 0 ] ; wb . WBProps = y ; break ; case "<workbookPr/>" : delete y [ 0 ] ; wb . WBProps = y ; break ; case "<workbookProtection" : break ; case "<workbookProtection/>" : break ; case "<bookViews>" : case "</bookViews>" : break ; case "<workbookView" : delete y [ 0 ] ; wb . WBView . push ( y ) ; break ; case "<sheets>" : case "</sheets>" : break ; case "<sheet" : delete y [ 0 ] ; y . name = utf8read ( y . name ) ; wb . Sheets . push ( y ) ; break ; case "<functionGroups" : case "<functionGroups/>" : break ; case "<functionGroup" : break ; case "<externalReferences" : case "</externalReferences>" : case "<externalReferences>" : break ; case "<externalReference" : break ; case "<definedNames/>" : break ; case "<definedNames>" : case "<definedNames" : pass = true ; break ; case "</definedNames>" : pass = false ; break ; case "<definedName" : case "<definedName/>" : case "</definedName>" : break ; case "<calcPr" : delete y [ 0 ] ; wb . CalcPr = y ; break ; case "<calcPr/>" : delete y [ 0 ] ; wb . CalcPr = y ; break ; case "<oleSize" : break ; case "<customWorkbookViews>" : case "</customWorkbookViews>" : case "<customWorkbookViews" : break ; case "<customWorkbookView" : case "</customWorkbookView>" : break ; case "<pivotCaches>" : case "</pivotCaches>" : case "<pivotCaches" : break ; case "<pivotCache" : b
var evert _RE = evert _key ( RecordEnum , "n" ) ; function fix _opts _func ( defaults ) { return function fix _opts ( opts ) { for ( var i = 0 ; i != defaults . length ; ++ i ) { var d = defaults [ i ] ; if ( typeof 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 ] , [ "sheetStubs" , false ] , [ "sheetRows" , 0 , "n" ] , [ "bookDeps" , false ] , [ "bookSheets" , false ] , [ "bookProps" , false ] , [ "bookFiles" , false ] , [ "bookVBA" , false ] , [ "WTF" , false ] ] ) ; var fix _write _opts = fix _opts _func ( [ [ "bookSST" , false ] , [ "bookType" , "xlsx" ] , [ "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 ( getzipdata ( 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 ( ) ; var entries = keys ( zip . files ) . filter ( nodirs ) . sort ( ) ; var dir = parse _ct ( getzipdata ( 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 = getzipdata ( zip , dir . coreprops [ 0 ] . replace ( /^\// , "" ) , true ) ; if ( propdata ) props = parse _core _props ( propdata ) ; if ( dir . extprops . length !== 0 ) { propdata = getzipdata ( 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 = getzipdata ( 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 ( getzipdata ( 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 = 0 ; i != props . Worksheets ; ++ i ) { if ( wbrels ) path = "xl/" + wbrels [ i ] [ 1 ] . replace ( /[\/]?xl\// , "" ) ; else { path = "xl/worksheets/sheet" + ( i + 1 - nmode ) + "." + wbext ; path = path . replace ( /sheet0\./ , "sheet." ) } relsPath = path . replace ( /^(.*)(\/)([^\/]*)$/ , "$1/_rels/$3.rels" ) ; safe _parse _ws ( zip , path , relsPath , props . SheetNames [ i ] , sheetRels , sheets , opts ) } if ( dir . comments ) parse _comments ( zip , dir . comments , sheets , sheetRels , opts ) ; out = { Directory : dir , Workbook : wb , Props : props , Custprops : custprops , Deps : d
2014-02-17 08:44:22 +00:00
//# sourceMappingURL=dist/xlsx.min.map