Selaa lähdekoodia

code tune for report excel output

TonyKang 7 vuotta sitten
vanhempi
commit
50b0f8c698
1 muutettua tiedostoa jossa 24 lisäystä ja 15 poistoa
  1. 24 15
      modules/reports/util/rpt_excel_util.js

+ 24 - 15
modules/reports/util/rpt_excel_util.js

@@ -342,21 +342,21 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){
     let private_pre_analyze_pos = function(){
         let cell, pos;
         let self_analyze_sheet_pos = function (theShtData, theXPos, theYPos) {
-            theShtData.cells.sort(function(cell1, cell2) {
-                let rst = 0;
-                if (cell1[JV.PROP_AREA][JV.PROP_TOP] > cell2[JV.PROP_AREA][JV.PROP_TOP]) {
-                    rst = 1;
-                } else if (cell1[JV.PROP_AREA][JV.PROP_TOP] < cell2[JV.PROP_AREA][JV.PROP_TOP]) {
-                    rst = -1;
-                } else {
-                    if (cell1[JV.PROP_AREA][JV.PROP_LEFT] > cell2[JV.PROP_AREA][JV.PROP_LEFT]) {
-                        rst = 1;
-                    } else if (cell1[JV.PROP_AREA][JV.PROP_LEFT] < cell2[JV.PROP_AREA][JV.PROP_LEFT]) {
-                        rst = -1;
-                    }
-                }
-                return rst;
-            });
+            // theShtData.cells.sort(function(cell1, cell2) {
+            //     let rst = 0;
+            //     if (cell1[JV.PROP_AREA][JV.PROP_TOP] > cell2[JV.PROP_AREA][JV.PROP_TOP]) {
+            //         rst = 1;
+            //     } else if (cell1[JV.PROP_AREA][JV.PROP_TOP] < cell2[JV.PROP_AREA][JV.PROP_TOP]) {
+            //         rst = -1;
+            //     } else {
+            //         if (cell1[JV.PROP_AREA][JV.PROP_LEFT] > cell2[JV.PROP_AREA][JV.PROP_LEFT]) {
+            //             rst = 1;
+            //         } else if (cell1[JV.PROP_AREA][JV.PROP_LEFT] < cell2[JV.PROP_AREA][JV.PROP_LEFT]) {
+            //             rst = -1;
+            //         }
+            //     }
+            //     return rst;
+            // });
             for (let i = 0; i < theShtData.cells.length; i++) {
                 cell = theShtData.cells[i];
                 pos = cell[JV.PROP_AREA][JV.PROP_LEFT];
@@ -625,11 +625,20 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){
         //remark: 1 excel unit width = 2.117 mm
         rst.push('<cols>');
         let w = 0;
+        /*
         for (let i = 1; i < xPos.length - 1; i++) {
             w = 1.0 * (xPos[i + 1] - xPos[i]) / DPI * 25.4 / 2.117;
             w = Math.round(w * 1000) / 1000;
             rst.push('<col min="' + i +'" max="' + i +'" width="' + w + '" customWidth="1"/>');
         }
+        /*/
+        for (let i = 1; i < xPos.length - 2; i++) {
+            w = 1.0 * (xPos[i + 1] - xPos[i]) / DPI * 25.4 / 2.117;
+            w = Math.round(w * 1000) / 1000;
+            rst.push('<col min="' + i +'" max="' + i +'" width="' + w + '" customWidth="1"/>');
+        }
+        rst.push('<col min="' + (xPos.length - 1) +'" max="' + (xPos.length - 1) +'" width="' + 10 + '" customWidth="1"/>');
+        //*/
         rst.push('</cols>');
     };
     let private_setMergedCells = function() {