| 
					
				 | 
			
			
				@@ -23,10 +23,10 @@ function writeContentTypes(sheets, isSinglePage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (isSinglePage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        rst.push('<Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        rst.push('<Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (let i = 0; i < sheets.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            rst.push('<Override PartName="/xl/worksheets/sheet' + (i + 1) + '.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            rst.push('<Override PartName="/xl/worksheets/sheet' + (i + 1) + '.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -60,11 +60,11 @@ function writeApp(sheets, isSinglePage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<TitlesOfParts>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (isSinglePage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         rst.push('<vt:vector size="1" baseType="lpstr">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        rst.push('<vt:lpstr>' + sheets[0].sheetName + '</vt:lpstr>') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        rst.push('<vt:lpstr>' + sheets[0].sheetName + '</vt:lpstr>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         rst.push('<vt:vector size="' + sheets.length + '" baseType="lpstr">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (let i = 0; i < sheets.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            rst.push('<vt:lpstr>' + sheets[i].sheetName + '</vt:lpstr>') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            rst.push('<vt:lpstr>' + sheets[i].sheetName + '</vt:lpstr>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('</vt:vector>'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -74,7 +74,6 @@ function writeApp(sheets, isSinglePage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<SharedDoc>false</SharedDoc>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<HyperlinksChanged>false</HyperlinksChanged>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<AppVersion>12.0000</AppVersion>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //rst.push(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('</Properties>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return rst; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -91,7 +90,9 @@ function writeCore() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<dc:creator>SmartCost</dc:creator>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<cp:lastModifiedBy>SmartCost</cp:lastModifiedBy>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let dt = new Date(), dtStr = dt.getFullYear() + '-' + p_fillZero(dt.getMonth()+1) + '-' + p_fillZero(dt.getDate()) + 'T' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let dt = new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    dt.setDate(dt.getDate() - 8/24); //it's GMT time, so please add the server offset time ( -8 hours ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let dtStr = dt.getFullYear() + '-' + p_fillZero(dt.getMonth()+1) + '-' + p_fillZero(dt.getDate()) + 'T' + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         p_fillZero(dt.getHours()) + ':' + p_fillZero(dt.getMinutes()) + ':' + p_fillZero(dt.getSeconds()) + 'Z'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<dcterms:created xsi:type="dcterms:W3CDTF">' + dtStr + '</dcterms:created>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<dcterms:modified xsi:type="dcterms:W3CDTF">' + dtStr + '</dcterms:modified>'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -116,7 +117,6 @@ function writeXlWorkBook(sheets, isSinglePage){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('</sheets>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<calcPr calcId="124519"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //rst.push(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('</workbook>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return rst; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -125,11 +125,11 @@ function writeXlRels(sheets, isSinglePage){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push(dftHeadXml + '\r\n'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (isSinglePage) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        rst.push('<Relationship Id="rId' + idx + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/>') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        rst.push('<Relationship Id="rId' + idx + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         idx++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (let i = 0; i < sheets.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            rst.push('<Relationship Id="rId' + idx + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet' + (i + 1) + '.xml"/>') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            rst.push('<Relationship Id="rId' + idx + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet' + (i + 1) + '.xml"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             idx++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -138,7 +138,6 @@ function writeXlRels(sheets, isSinglePage){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<Relationship Id="rId' + idx + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     idx++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<Relationship Id="rId' + idx + '" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //rst.push(''); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('</Relationships>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return rst; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -151,7 +150,7 @@ function writeStyles(stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push(dftHeadXml + '\r\n'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //1. push fonts 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    rst.push('<fonts count="' + stylesObj.fonts.length + '">') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    rst.push('<fonts count="' + stylesObj.fonts.length + '">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for (let i = 0; i < stylesObj.fonts.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let font = stylesObj.fonts[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         rst.push('<font>'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -171,14 +170,14 @@ function writeStyles(stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //2. push default fills 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<fills count="2"><fill><patternFill patternType="none" /></fill><fill><patternFill patternType="gray125" /></fill></fills>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //3. push borders 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    rst.push('<borders count="' + stylesObj.borders.length + '">') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    rst.push('<borders count="' + stylesObj.borders.length + '">'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let private_setBorder = function(border, borderDirection) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (border[borderDirection][JV.PROP_LINE_WEIGHT] == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (parseInt(border[borderDirection][JV.PROP_LINE_WEIGHT]) === 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             rst.push('<' + borderDirection.toLowerCase() + '/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let bW = 'thin'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (border[borderDirection][JV.PROP_LINE_WEIGHT] == 2) bW = 'medium'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (border[borderDirection][JV.PROP_LINE_WEIGHT] > 2) bW = 'thick'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (parseInt(border[borderDirection][JV.PROP_LINE_WEIGHT]) === 2) bW = 'medium'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (parseInt(border[borderDirection][JV.PROP_LINE_WEIGHT]) > 2) bW = 'thick'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             rst.push('<' + borderDirection.toLowerCase() + ' style="' + bW + '">' + '<color indexed="64"/>' + '</' + borderDirection.toLowerCase() + '>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -244,7 +243,7 @@ function writeStyles(stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             newVertical = tmpV; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         alignStr += ' horizontal="' + newHorizontal + '" vertical="' + newVertical + '"'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (strUtil.convertStrToBoolean(excelStyle[JV.CONTROL_PROPS[1]])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (strUtil.convertStrToBoolean(excelStyle[JV.CONTROL_PROPS[0]])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             alignStr += ' shrinkToFit="1"'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (strUtil.convertStrToBoolean(excelStyle[JV.CONTROL_PROPS[4]])) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -340,26 +339,25 @@ function writeSheets(pageData, paperSize, sharedStrList, stylesObj, isSinglePage 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let rst = [], xPos = [], yPos = [], yMultiPos = [], headerStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let cacheBorderCell = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let currentPageMergePos = null; //在 JV.PAGING_OPTION_INFINITY 场合应用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     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]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -381,11 +379,16 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             yPos.sort(private_array_sort); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //total data in one sheet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let marginBottomPos = Math.round( (pageData[JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE][1] - parseFloat(pageData[JV.NODE_PAGE_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM]) / 2.54 ) * DPI); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (let shtItemData of pageData.items) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let tmpPos = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tmpPos.push(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 self_analyze_sheet_pos(shtItemData, xPos, tmpPos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tmpPos.sort(private_array_sort); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (marginBottomPos - tmpPos[tmpPos.length - 1] > 10) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //此逻辑是为了防止打印跨页(假设有些报表模板高度设置离底部margin还好远,导出excel后预览时会发现跨页现象(即下一页的某几行数据会挪到前一页来预览)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    tmpPos.push(marginBottomPos - 10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 yMultiPos.push(tmpPos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             xPos.sort(private_array_sort); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -493,7 +496,7 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let private_chkAndGetMergeLine = function(cell, sheetBorder, borderStr, needFurtherChk) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let rst = 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            mergeBorder = (sheetData[JV.PROP_PAGE_MERGE_BORDER])?sheetData[JV.PROP_PAGE_MERGE_BORDER]:pageData[JV.BAND_PROP_MERGE_BAND], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            mergeBorder = (sheetData)?sheetData[JV.PROP_PAGE_MERGE_BORDER]:pageData[JV.BAND_PROP_MERGE_BAND], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             mergeBand = pageData[JV.BAND_PROP_MERGE_BAND] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (sheetBorder[borderStr] && sheetBorder[borderStr][JV.PROP_LINE_WEIGHT] !== undefined) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -625,7 +628,7 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return rst; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let private_setCols = function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //remark: 1 excel width = 2.117 mm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //remark: 1 excel unit width = 2.117 mm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         rst.push('<cols>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let w = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (let i = 1; i < xPos.length - 1; i++) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -633,6 +636,7 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             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() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -666,58 +670,11 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         rst[startIdx] = '<mergeCells count="' + cnt + '">'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         rst.push('</mergeCells>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let private_chkIfNeedCacheCell = function(cell){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let rst = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (cell[JV.PROP_AREA][JV.PROP_LEFT] === pageData[JV.BAND_PROP_MERGE_BAND][JV.PROP_LEFT] || 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cell[JV.PROP_AREA][JV.PROP_RIGHT] === pageData[JV.BAND_PROP_MERGE_BAND][JV.PROP_RIGHT] || 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cell[JV.PROP_AREA][JV.PROP_TOP] === pageData[JV.BAND_PROP_MERGE_BAND][JV.PROP_TOP] || 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            cell[JV.PROP_AREA][JV.PROP_BOTTOM] === pageData[JV.BAND_PROP_MERGE_BAND][JV.PROP_BOTTOM]){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (cell[JV.PROP_AREA][JV.PROP_LEFT] >= pageData[JV.BAND_PROP_MERGE_BAND][JV.PROP_LEFT] && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cell[JV.PROP_AREA][JV.PROP_RIGHT] <= pageData[JV.BAND_PROP_MERGE_BAND][JV.PROP_RIGHT] && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cell[JV.PROP_AREA][JV.PROP_TOP] >= pageData[JV.BAND_PROP_MERGE_BAND][JV.PROP_TOP] && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cell[JV.PROP_AREA][JV.PROP_BOTTOM] <= pageData[JV.BAND_PROP_MERGE_BAND][JV.PROP_BOTTOM]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                rst = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return rst; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let private_cacheMergeBandBorderIdxs = function() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let cell, idxR, idxL, idxT, idxB; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let self_cachMergeIdxs = function (theData, theYPos, offsetY) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (let i = 0; i < theData.cells.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                cell = theData.cells[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                idxR = xPos.indexOf(cell[JV.PROP_AREA][JV.PROP_RIGHT]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                idxL = xPos.indexOf(cell[JV.PROP_AREA][JV.PROP_LEFT]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                idxB = theYPos.indexOf(cell[JV.PROP_AREA][JV.PROP_BOTTOM]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                idxT = theYPos.indexOf(cell[JV.PROP_AREA][JV.PROP_TOP]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (idxR - idxL > 1 || idxB - idxT > 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (private_chkIfNeedCacheCell(cell)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        for (let xi = idxL; xi < idxR; xi++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            for (let yj = idxT; yj < idxB; yj++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                cacheBorderCell[private_getCellIdxStr(xi - 1) + yj + offsetY] = cell; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (sheetData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            self_cachMergeIdxs(sheetData, yPos, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let osY = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for (let i = 0; i < pageData.items.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let shtItemData = pageData.items[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let tmpPos = yMultiPos[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                self_cachMergeIdxs(shtItemData, tmpPos, osY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                osY += tmpPos.length - 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let private_setSheetData = function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //remark: 1 excel height = 0.3612 mm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //remark: 1 excel unit height = 0.3612 mm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         rst.push('<sheetData>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let spanX = xPos.length - 2, cellIdx = 0, h = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let self_setDataEx = function (theShtData, theYPos, offsetY) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let rows = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //1. build full set of blank rows/cells 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -783,7 +740,6 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //4. maybe need to dispose the memory 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //... 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        private_cacheMergeBandBorderIdxs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (sheetData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //current sheet data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             currentPageMergePos = sheetData[JV.PAGE_SPECIAL_MERGE_POS]; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -817,7 +773,9 @@ function writeSheet(pageData, sheetData, paperSize, sharedStrList, stylesObj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private_setSheetData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private_setMergedCells(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     rst.push('<phoneticPr fontId="1" type="noConversion"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    rst.push('<pageMargins left="0.315" right="0.215" top="0.315" bottom="0.315" header="0" footer="0"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // rst.push('<pageMargins left="0.315" right="0.215" top="0.315" bottom="0.315" header="0" footer="0"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    rst.push('<pageMargins left="' + (parseFloat(pageData[JV.NODE_PAGE_INFO][JV.NODE_MARGINS][JV.PROP_LEFT]) * 0.39375) + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        '" right="0.215" top="0.315" bottom="0.315" header="0" footer="0"/>'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let paperSizeIdx = JV.PAGES_SIZE_STR.indexOf(paperSize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let pStr = ''; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (paperSizeIdx >= 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -928,12 +886,12 @@ module.exports = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             zip.generateNodeStream({type:'nodebuffer',streamFiles:true}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .pipe(fs.createWriteStream(__dirname.slice(0, __dirname.length - 21) + '/tmp/' + newName + '.xlsx')) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 .on('finish', function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // JSZip generates a readable stream with a "end" event, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // but is piped here in a writable stream which emits a "finish" event. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    console.log(newName + ".xlsx was written."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (callback) callback(newName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // JSZip generates a readable stream with a "end" event, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        // but is piped here in a writable stream which emits a "finish" event. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        console.log(newName + ".xlsx was written."); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (callback) callback(newName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //return zip.generateNodeStream({type:'nodebuffer',streamFiles:true}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return zip; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -993,7 +951,11 @@ module.exports = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         pageDataArray[i].items[j].cells[k][JV.PROP_AREA][JV.PROP_BOTTOM] += offsetY; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         pageDataArray[i].items[j].cells[k][JV.PROP_AREA][JV.PROP_TOP] += offsetY; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let bottomGap = Math.round( (pageDataArray[i][JV.NODE_PAGE_INFO][JV.NODE_PAGE_SIZE][1] - parseFloat(pageDataArray[i][JV.NODE_PAGE_INFO][JV.NODE_MARGINS][JV.PROP_BOTTOM]) / 2.54 ) * DPI) - maxY; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     offsetY += (maxY - minY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (bottomGap > 10) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        offsetY += (bottomGap - 10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //2. newPageData的items属性 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1013,7 +975,7 @@ module.exports = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //3. everything is ok, then call me 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             me.exportExcel(newPageData, paperSize, fName, 'false', sheetNames, callback); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            fsUtil.writeObjToFile(newPageData, 'D:/GitHome/ConstructionOperation/tmp/combinedHeader.js'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // fsUtil.writeObjToFile(newPageData, 'D:/GitHome/ConstructionOperation/tmp/combinedHeader.js'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             console.log(e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |