Browse Source

导出Excel速度问题

MaiXinRong 5 years ago
parent
commit
52f572e7bc
1 changed files with 5 additions and 0 deletions
  1. 5 0
      app/public/js/shares/export_excel.js

+ 5 - 0
app/public/js/shares/export_excel.js

@@ -12,6 +12,8 @@ const SpreadExcelObj = (function() {
     const _createHideSpread = function () {
         const div = document.createElement("div");
         div.setAttribute('id', 'exportExcelSpread');
+        // $(div).css("position", "absolute").css('top', 0).css('left', 0).css('height', 300).css('width', 500).css('z-index', 999);
+        // document.body.insertBefore(div, null);
         div.style.display = 'none';
         return div;
     };
@@ -35,6 +37,8 @@ const SpreadExcelObj = (function() {
 
         const spread = SpreadJsObj.createNewSpread(div);
         const sheet = spread.getActiveSheet();
+
+        SpreadJsObj.beginMassOperation(sheet);
         sheet.options.isProtected = false;
         sheet.setColumnCount(setting.cols.length);
         sheet.setRowCount(setting.headRows + data.length);
@@ -79,6 +83,7 @@ const SpreadExcelObj = (function() {
                 cell.hAlign(col.hAlign);
             }
         }
+        SpreadJsObj.endMassOperation(sheet);
 
         const excelIo = new GC.Spread.Excel.IO();
         const sJson = JSON.stringify(spread.toJSON());