/* (c) DHTMLX Ltd, 2011 Licensing: You allowed to use this component for free under GPL or you need to obtain Commercial/Enterprise license to use it in non-GPL project Contact: sales@dhtmlx.com */ dhtmlxSpreadSheet.prototype.toPDF = function(url) { var xml = this._getExport(true); var form = document.createElement('div'); form.style.display = 'none'; document.body.appendChild(form); form.innerHTML = '
'; form.firstChild.firstChild.value = xml; form.firstChild.submit(); form.parentNode.removeChild(form); }; dhtmlxSpreadSheet.prototype.toExcel = function(url) { var xml = this._getExport(); var iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.name = 'dhx_' + this.grid.uid(); iframe.onload = function() { window.setTimeout(function() { iframe.parentNode.removeChild(iframe); }, 3000); }; document.body.appendChild(iframe); var form = document.createElement('div'); form.style.display = 'none'; document.body.appendChild(form); form.innerHTML = ''; form.firstChild.firstChild.value = xml; form.firstChild.submit(); form.parentNode.removeChild(form); }; dhtmlxSpreadSheet.prototype._getExport = function(firstcol) { var maxrow = 0, maxcol = 1; this.mapCells(1, 1, this.settings.rows, this.settings.cols, function(row, col) { var cell = this.getCellValue(row, col); if (cell.value.length > 0) { if (row > maxrow) maxrow = row; if (col > maxcol) maxcol = col; } }); if (maxrow < 5) maxrow = Math.min(5 || this.settings.rows); if (maxcol < 5) maxcol = Math.min(5 || this.settings.cols); var head = this._getExportHeader(maxrow, maxcol, firstcol); var rows = this._getExportData(maxrow, maxcol, firstcol); var orient = this._getExportWidth(maxrow, maxcol, firstcol); var xml = '