/*! * filename: ej2-excel-export.min.js * version : 19.1.54 * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ this.ej=this.ej||{},this.ej.excelexport=function(e,t,r){"use strict";var o=function(){function e(){this.numFmtId=0,this.backColor="none",this.fontName="Calibri",this.fontSize=10.5,this.fontColor="#000000",this.italic=!1,this.bold=!1,this.underline=!1,this.wrapText=!1,this.hAlign="general",this.vAlign="bottom",this.indent=0,this.rotation=0,this.numberFormat="GENERAL",this.type="datetime",this.borders=new m,this.isGlobalStyle=!1}return e}(),i=function(){function e(){this.sz=10.5,this.name="Calibri",this.u=!1,this.b=!1,this.i=!1,this.color="FF000000"}return e}(),n=function(){function e(){}return e}(),l=function(){function e(){}return e}(),s=function(){function e(){}return e}(),a=function(){function e(){this.name="Normal",this.xfId=0}return e}(),d=function(){function e(e,t){this.numFmtId=e,this.formatCode=t}return e}(),h=function(){function e(e,t){this.lineStyle=e,this.color=t}return e}(),m=function(){function e(){this.left=new h("none","#FFFFFF"),this.right=new h("none","#FFFFFF"),this.top=new h("none","#FFFFFF"),this.bottom=new h("none","#FFFFFF"),this.all=new h("none","#FFFFFF")}return e}(),p=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),u=function(){function e(){}return e}(),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.add=function(e){for(var r=!1,o=0,i=0,n=t;i=0);return t},e.prototype.parserPrintTitle=function(e,t){var r,o="";if(null!==e.fromRow&&void 0!==e.fromRow){r="$"+e.fromRow+":$"+(null!==e.toRow&&void 0!==e.toRow?e.toRow:e.fromRow)}var i;if(null!==e.fromColumn&&void 0!==e.fromColumn){var n=e.fromColumn,l=void 0;l=null!==e.toColumn&&void 0!==e.toColumn?e.toColumn:e.fromColumn,i="$"+this.getColumnName(n)+":$"+this.getColumnName(l)}void 0!==r&&(o+=t.name+"!"+r),void 0!==i&&void 0!==r?o+=","+t.name+"!"+i:void 0!==i&&(o+=t.name+"!"+i),""!==o&&this.printTitles.set(t.index-1,o)},e.prototype.parserFreezePanes=function(e,t){t.freezePanes=new I,null!==e.row&&void 0!==e.row?t.freezePanes.row=e.row:t.freezePanes.row=0,null!==e.column&&void 0!==e.column?t.freezePanes.column=e.column:t.freezePanes.column=0,t.freezePanes.leftCell=this.getCellName(t.freezePanes.row+1,t.freezePanes.column+1)},e.prototype.parserColumns=function(e,t){var r=e.length;t.columns=[];for(var o=0;o0&&this.mergedCellsStyle.forEach(function(o,i){var n=e.rows.filter(function(e){return e.index===o.y})[0];if(r.isNullOrUndefined(n)){var l=e.rows.filter(function(e){return e.index<=o.y}),s=new g;s.index=o.y,s.cells=new c,s.cells.add(t.createCell(o,i));h=0;l.length>0&&(h=e.rows.indexOf(l[l.length-1])+1),e.rows.splice(h,0,s)}else{var a=n.cells.filter(function(e){return e.index===o.x})[0];if(r.isNullOrUndefined(a)){var d=n.cells.filter(function(e){return e.index<=o.x}),h=0;d.length>0&&(h=n.cells.indexOf(d[d.length-1])+1),n.cells.splice(h,0,t.createCell(o,i))}else a.styleIndex=o.styleIndex}})},e.prototype.createCell=function(e,t){var r=new u;return r.refName=t,r.index=e.x,r.cellStyle=new o,r.styleIndex=e.styleIndex,r},e.prototype.parserRow=function(e,t){var r=new g;if(null!==e.height&&void 0!==e.height&&(r.height=e.height),null===e.index||void 0===e.index)throw Error("Row index is missing.");return r.index=e.index,null!==e.grouping&&void 0!==e.grouping&&this.parseGrouping(e.grouping,r),this.parseCells(e.cells,r),r},e.prototype.parseGrouping=function(e,t){t.grouping=new C,void 0!==e.outlineLevel&&(t.grouping.outlineLevel=e.outlineLevel),void 0!==e.isCollapsed&&(t.grouping.isCollapsed=e.isCollapsed),void 0!==e.isHidden&&(t.grouping.isHidden=e.isHidden)},e.prototype.parseCells=function(e,t){t.cells=new c;for(var r=void 0!==e?e.length:0,i=1,n=1,l=0;ln&&(n=a.index),a.refName=this.getCellName(t.index,a.index),null!==s.rowSpan&&void 0!==s.rowSpan?a.rowSpan=s.rowSpan-1:a.rowSpan=0,null!==s.colSpan&&void 0!==s.colSpan?a.colSpan=s.colSpan-1:a.colSpan=0,null!==s.hyperlink&&void 0!==s.hyperlink){var d=new S;void 0!==s.hyperlink.target&&(d.target=s.hyperlink.target,void 0!==s.hyperlink.displayText?a.value=s.hyperlink.displayText:a.value=s.hyperlink.target,a.type=this.getCellValueType(a.value),d.ref=a.refName,d.rId=this.mHyperLinks.length+1,this.mHyperLinks.push(d),a.cellStyle=new o,this.parserCellStyle(void 0!==s.style?this.mergeOptions(s.style,this.hyperlinkStyle):this.hyperlinkStyle,a.cellStyle,"string"),a.styleIndex=a.cellStyle.index)}null!==s.formula&&void 0!==s.formula&&(a.formula=s.formula,a.type="formula"),null!==s.value&&void 0!==s.value&&(void 0!==a.formula?a.value=0:(a.value=s.value,a.type=this.getCellValueType(a.value))),null!==s.style&&void 0!==s.style&&void 0===a.styleIndex?(a.cellStyle=new o,a.value instanceof Date?this.parserCellStyle(s.style,a.cellStyle,a.type,14):this.parserCellStyle(s.style,a.cellStyle,a.type),a.styleIndex=a.cellStyle.index):a.value instanceof Date&&(a.cellStyle=new o,this.parserCellStyle({},a.cellStyle,a.type,14),a.styleIndex=a.cellStyle.index),this.parseCellType(a),this.mergeCells=this.processMergeCells(a,t.index,this.mergeCells),t.cells.add(a)}t.spans=i+":"+n},e.prototype.GetColors=function(){var e;return(e=new Map).set("WHITE","FFFFFFFF"),e.set("SILVER","FFC0C0C0"),e.set("GRAY","FF808080"),e.set("BLACK","FF000000"),e.set("RED","FFFF0000"),e.set("MAROON","FF800000"),e.set("YELLOW","FFFFFF00"),e.set("OLIVE","FF808000"),e.set("LIME","FF00FF00"),e.set("GREEN","FF008000"),e.set("AQUA","FF00FFFF"),e.set("TEAL","FF008080"),e.set("BLUE","FF0000FF"),e.set("NAVY","FF000080"),e.set("FUCHSIA","FFFF00FF"),e.set("PURPLE","FF800080"),e},e.prototype.processColor=function(e){return 0===e.indexOf("#")?e.replace("#","FF"):(e=e.toUpperCase(),this.rgbColors=this.GetColors(),e=this.rgbColors.has(e)?this.rgbColors.get(e):"FF000000")},e.prototype.processCellValue=function(e,t){var r=e;if(-1!==e.indexOf("")||-1!==e.indexOf("")||-1!==e.indexOf("")){var o="",i=e.indexOf("<",0),n=e.indexOf(">",i+1);if(i>=0&&n>=0){for(0!==i&&(o+=''+e.substring(0,i)+"");i>=0&&n>=0;)if((n=e.indexOf(">",i+1))>=0){var l=e.substring(i+1,n);(i=e.indexOf("<",n+1))<0&&(i=r.length);var s=r.substring(n+1,i);if(0!==s.length){var a=l.split(" ");if(a.length>0&&(o+=""),a.length>1)for(var d=0,h=a;d';break;case"face=":o+='';break;case"color":o+='';break;case"href=":var p=new S;p.target=m.substring(6,m.length-1).trim(),p.ref=t.refName,p.rId=this.mHyperLinks.length+1,this.mHyperLinks.push(p),o+=''}}else if(1===a.length)switch(a[0].trim()){case"b":o+="";break;case"i":o+="";break;case"u":o+=""}o+=''+s+""}}return""===o?r:o}return r}return r},e.prototype.applyGlobalStyle=function(e,t){this.cellStyles.has(e.name)&&(t.index=this.mStyles.filter(function(t){return t.name===e.name})[0].index,t.name=e.name)},e.prototype.parserCellStyle=function(e,t,r,o){if(null!==e.name&&void 0!==e.name){if(!t.isGlobalStyle)return void this.applyGlobalStyle(e,t);t.name=e.name}null!==e.backColor&&void 0!==e.backColor&&(t.backColor=e.backColor),t.borders=new m,null!==e.borders&&void 0!==e.borders&&this.parserBorder(e.borders,t.borders.all),null!==e.leftBorder&&void 0!==e.leftBorder&&this.parserBorder(e.leftBorder,t.borders.left),null!==e.rightBorder&&void 0!==e.rightBorder&&this.parserBorder(e.rightBorder,t.borders.right),null!==e.topBorder&&void 0!==e.topBorder&&this.parserBorder(e.topBorder,t.borders.top),null!==e.bottomBorder&&void 0!==e.bottomBorder&&this.parserBorder(e.bottomBorder,t.borders.bottom),null!==e.fontName&&void 0!==e.fontName&&(t.fontName=e.fontName),null!==e.fontSize&&void 0!==e.fontSize&&(t.fontSize=e.fontSize),null!==e.fontColor&&void 0!==e.fontColor&&(t.fontColor=e.fontColor),null!==e.italic&&void 0!==e.italic&&(t.italic=e.italic),null!==e.bold&&void 0!==e.bold&&(t.bold=e.bold),null!==e.hAlign&&void 0!==e.hAlign&&(t.hAlign=e.hAlign.toLowerCase()),null!==e.indent&&void 0!==e.indent&&(t.indent=e.indent,"left"!==t.hAlign&&"right"!==t.hAlign&&(t.hAlign="left")),null!==e.rotation&&void 0!==e.rotation&&(t.rotation=e.rotation),null!==e.vAlign&&void 0!==e.vAlign&&(t.vAlign=e.vAlign.toLowerCase()),null!==e.underline&&void 0!==e.underline&&(t.underline=e.underline),null!==e.wrapText&&void 0!==e.wrapText&&(t.wrapText=e.wrapText),null!==e.numberFormat&&void 0!==e.numberFormat?null!==e.type&&void 0!==e.type?t.numberFormat=this.getNumberFormat(e.numberFormat,e.type):t.numberFormat=this.getNumberFormat(e.numberFormat,r):void 0!==o?(t.numFmtId=14,t.numberFormat="GENERAL"):t.numberFormat="GENERAL",t.index=this.processCellStyle(t)},e.prototype.switchNumberFormat=function(e,t){var r=this.getNumberFormat(e,t);if(r!==e){var o=this.mNumFmt.get(e);if(void 0!==o&&(o.formatCode=r,this.mNumFmt.has(r))){for(var i=0,n=this.mCellStyleXfs;i-1&&r';if(t+="",e+=t,this.printTitles.size>0){var i="";this.printTitles.forEach(function(e,t){i+=''+e+""}),e+=i+=""}this.addToArchive(e+"","xl/workbook.xml")},e.prototype.saveWorksheets=function(){for(var e=this.worksheets.length,t=0;t':n+=''}i+=n+""}if(i+="",o.append(i),i="",void 0!==e.rows)for(var d=0,h=e.rows;d"+f.formula+""),void 0!==f.value?p+=""+f.value+"":p+="")}p+="",o.append(p)}if(i+="",null!==e.autoFilters&&void 0!==e.autoFilters&&(i+=''),e.mergeCells.length>0){i+='';for(var v=0,g=e.mergeCells;v';i+=""}if(e.hyperLinks.length>0){i+="";for(var y=0,x=e.hyperLinks;y'}i+=""}i+='',void 0!=e.images&&e.images.length>0&&(this.drawingCount++,this.saveDrawings(e,e.index),i+=''),this.addToArchive(this.saveSheetRelations(e),"xl/worksheets/_rels/sheet"+e.index+".xml.rels"),o.append(i+""),this.addToArchive(o.getBlob(),"xl/worksheets/sheet"+(t+1)+".xml")},e.prototype.saveDrawings=function(e,t){var r=new A,o='';if(void 0!==e.images){for(var i=0,n=0,l=e.images;n',o+="",o+=s.column-1,o+="",o+=0,o+="",o+=s.row-1,o+="",o+=0,o+="",o+="",o+=s.lastColumn,o+="",o+=s.lastColOffset,o+="",o+=s.lastRow,o+="",o+=s.lastRowOffset,o+="",o+="",o+="",o+=' ',o+=' ',o+="",o+='',o+="",o+="",o+="=-3600&&(o+=' rot="'+6e4*s.rotation+'"'),void 0!=s.verticalFlip&&0!=s.verticalFlip&&(o+=' flipV="1"'),void 0!=s.horizontalFlip&&0!=s.horizontalFlip&&(o+=' flipH="1"'),o+="/>",o+='',o+="";var a=this.convertBase64toImage(s.image);this.imageCount+=1,this.addToArchive(a,"xl/media/image"+this.imageCount+".png")}r.append(o),r.append(""),this.saveDrawingRelations(e),this.addToArchive(r.getBlob(),"xl/drawings/drawing"+this.drawingCount+".xml")}},e.prototype.updatelastRowOffset=function(e,t){for(var r=t.height,o=t.row,i=0;r>=0;){var n=0,l=(n=void 0!==e.rows&&void 0!==e.rows[o-1]?this.convertToPixels(void 0===e.rows[o-1].height?15:e.rows[o-1].height):this.convertToPixels(15))-i*n/256;if(l>r){t.lastRow=o,t.lastRowOffset=i+256*r/n;var s=0;s=void 0!==e.rows&&void 0!==e.rows[o-1]?this.convertToPixels(void 0===e.rows[o-1].height?15:e.rows[o-1].height):this.convertToPixels(15),t.lastRowOffset=s*t.lastRowOffset/256,t.lastRowOffset=Math.round(t.lastRowOffset/this.unitsProportions[7]);break}r-=l,o++,i=0}},e.prototype.updatelastColumnOffSet=function(e,t){for(var r=t.width,o=t.column,i=0;r>=0;){var n=0,l=(n=void 0!==e.columns&&void 0!==e.columns[o-1]?this.ColumnWidthToPixels(void 0===e.columns[o-1].width?8.43:e.columns[o-1].width):this.ColumnWidthToPixels(8.43))-i*n/1024;if(l>r){t.lastColumn=o,t.lastColOffset=i+1024*r/n;var s=0;s=void 0!==e.columns&&void 0!==e.columns[o-1]?this.ColumnWidthToPixels(void 0===e.columns[o-1].width?8.43:e.columns[o].width):this.ColumnWidthToPixels(8.43),t.lastColOffset=s*t.lastColOffset/1024,t.lastColOffset=Math.round(t.lastColOffset/this.unitsProportions[7]);break}r-=l,o++,i=0}},e.prototype.convertToPixels=function(e){return e*this.unitsProportions[6]},e.prototype.convertBase64toImage=function(e){for(var t=window.atob(e),r=new ArrayBuffer(t.length),o=new Uint8Array(r),i=0;i';this.addToArchive(t+"","xl/drawings/_rels/drawing"+this.drawingCount+".xml.rels")},e.prototype.pixelsToColumnWidth=function(e){var t=e>12?this.trunc((e-5)/7*100+.5)/100:e/12;return t>1?(7*t+5)/7*256/256:12*t/7*256/256},e.prototype.ColumnWidthToPixels=function(e){var t=e>1?(7*e+5)/7*256/256:12*e/7*256/256;return this.trunc((256*t+this.trunc(128/7))/256*7)},e.prototype.trunc=function(e){var t=e-e%1;return 0===t&&(e<0||0===e&&1/e!=1/0)?-0:t},e.prototype.pixelsToRowHeight=function(e){return e*this.unitsProportions[5]/this.unitsProportions[6]},e.prototype.saveSheetRelations=function(e){for(var t='',r=0,o=e.hyperLinks;r'}return void 0!=e.images&&e.images.length>0&&(t+=''),t+=""},e.prototype.saveSheetView=function(e){var t='':t+=">",void 0!==e.freezePanes&&(t+='0){for(var t='',r="",o=0;o")?(r+="",r+=this.processString(this.sharedString[o]),r+=""):(r+="",r+=this.sharedString[o],r+="");r+="",this.addToArchive(t+r,"xl/sharedStrings.xml")}},e.prototype.processString=function(e){return-1!==e.indexOf("&")&&(e=e.replace(/&/g,"&")),-1!==e.indexOf("<")&&(e=e.replace(/")&&(e=e.replace(/>/g,">")),e},e.prototype.saveStyles=function(){this.updateCellXfsStyleXfs();var e='';e+=this.saveNumberFormats(),e+=this.saveFonts(),e+=this.saveFills(),e+=this.saveBorders(),e+=this.saveCellStyleXfs(),e+=this.saveCellXfs(),e+=this.saveCellStyles(),this.addToArchive(e+"","xl/styles.xml")},e.prototype.updateCellXfsStyleXfs=function(){for(var e=0,t=this.mStyles;e=1){var e='';return this.mNumFmt.forEach(function(t,r){e+=''}),e+=""}return""},e.prototype.saveFonts=function(){var e='';if(this.mFonts.length>=1)for(var t=0,r=this.mFonts;t",o.b&&(e+=""),o.i&&(e+=""),o.u&&(e+=""),e+='',e+='',e+=''}return e+""},e.prototype.saveFills=function(){var e='';return this.mFills.size>=1&&this.mFills.forEach(function(t,r){e+=''}),e+""},e.prototype.saveBorders=function(){var e='';if(this.mBorders.length>=1)for(var t=0,r=this.mBorders;t'}else e+=''}return e+""},e.prototype.saveCellStyles=function(){var e=this,t='';return this.cellStyles.forEach(function(r,o){t+='';if(this.mCellStyleXfs.length>=1)for(var t=0,r=this.mCellStyleXfs;t"+this.saveAlignment(o)+"":e+=" />"}return e+""},e.prototype.saveCellXfs=function(){var e='';if(this.mCellXfs.length>=1)for(var t=0,r=this.mCellXfs;t"+this.saveAlignment(o)+""}return e+""},e.prototype.saveAlignment=function(e){var t="'},e.prototype.saveApp=function(e){var t='Essential XlsIO';void 0!==e&&(void 0!==e.manager&&(t+=""+e.manager+""),void 0!==e.company&&(t+=""+e.company+"")),this.addToArchive(t+"","docProps/app.xml")},e.prototype.saveCore=function(e){var t=new Date,r='';void 0!==this.builtInProperties?(void 0!==e.author&&(r+=""+e.author+""),void 0!==e.subject&&(r+=""+e.subject+""),void 0!==e.category&&(r+=""+e.category+""),void 0!==e.comments&&(r+=""+e.comments+""),void 0!==e.title&&(r+=""+e.title+""),void 0!==e.tags&&(r+=""+e.tags+""),void 0!==e.status&&(r+=""+e.status+""),void 0!==e.createdDate?r+=''+e.createdDate.toISOString()+"":r+=''+t.toISOString()+"",void 0!==e.modifiedDate?r+=''+e.modifiedDate.toISOString()+"":r+=''+t.toISOString()+""):(r+=''+t.toISOString()+"",r+=''+t.toISOString()+""),r+="",this.addToArchive(r,"docProps/core.xml")},e.prototype.saveTopLevelRelation=function(){this.addToArchive('',"_rels/.rels")},e.prototype.saveWorkbookRelation=function(){for(var e='',t=this.worksheets.length,r=0,o=0;o';e+='',this.sharedStringCount>0&&(e+=''),this.addToArchive(e+"","xl/_rels/workbook.xml.rels")},e.prototype.saveContentType=function(){for(var e='',t="",r=this.worksheets.length,o=0;o',void 0!=this.worksheets[o].images&&this.worksheets[o].images.length>0&&(t+='');this.imageCount>0&&(t+=''),this.sharedStringCount>0&&(e+=''),this.addToArchive(e+t+"","[Content_Types].xml")},e.prototype.addToArchive=function(e,r){if("string"==typeof e){var o=new Blob([e],{type:"text/plain"}),i=new t.ZipArchiveItem(o,r);this.mArchive.addItem(i)}else{i=new t.ZipArchiveItem(e,r);this.mArchive.addItem(i)}},e.prototype.processMergeCells=function(e,t,r){if(0!==e.rowSpan||0!==e.colSpan){var o=new k;o.x=e.index,o.width=e.colSpan,o.y=t,o.height=e.rowSpan;var i=this.getCellName(o.y,o.x),n=this.getCellName(t+o.height,e.index+o.width);o.ref=i+":"+n;r.add(o);var l={x:o.x,y:o.y},s={x:e.index+o.width,y:t+o.height};this.updatedMergedCellStyles(l,s,e)}return r},e.prototype.updatedMergedCellStyles=function(e,t,r){for(var o=e.x;o<=t.x;o++)for(var i=e.y;i<=t.y;i++)this.mergedCellsStyle.set(this.getCellName(i,o),{x:o,y:i,styleIndex:r.styleIndex})},e.prototype.dateToTicks=function(e,t,r){var o=[0,31,59,90,120,151,181,212,243,273,304,334,365],i=[0,31,60,91,121,152,182,213,244,274,305,335,366];if(e>=1&&e<=9999&&t>=1&&t<=12){var n=e-1;return 864e9*(365*n+(n/4|0)-(n/100|0)+(n/400|0)+(this.isLeapYear(e)?i:o)[t-1]+r-1)}throw new Error("Not a valid date")},e.prototype.timeToTicks=function(e,t,r){if(e>=0&&e<24&&t>=0&&t<60&&r>=0&&r<60)return 1e4*(3600*e+60*t+r)*1e3;throw new Error("Not valid time")},e.prototype.isLeapYear=function(e){return e%4==0&&(e%100!=0||e%400==0)},e.prototype.toOADate=function(e){var t=0;if(0===(t=this.dateToTicks(e.getFullYear(),e.getMonth()+1,e.getDate())+this.timeToTicks(e.getHours(),e.getMinutes(),e.getSeconds())))return 0;if(t<31241376e9)throw new Error("Arg_OleAutDateInvalid");return(t-599264352e9)/1e4/864e5},e}(),D=function(){function e(){}return e}();return e.CellStyle=o,e.Font=i,e.CellXfs=n,e.Alignment=l,e.CellStyleXfs=s,e.CellStyles=a,e.NumFmt=d,e.Border=h,e.Borders=m,e.Cell=u,e.Cells=c,e.Column=f,e.Row=g,e.Rows=y,e.Workbook=B,e.BuiltInProperties=D,e.Worksheet=F,e.HyperLink=S,e.Grouping=C,e.FreezePane=I,e.MergeCell=k,e.MergeCells=T,e.Worksheets=w,e.CsvHelper=N,e.ValueFormatter=P,e.BlobHelper=A,e}({},ej.compression,ej.base),this.ejs=ej;