Browse Source

code sync

TonyKang 6 years ago
parent
commit
44eddc844f
1 changed files with 8 additions and 0 deletions
  1. 8 0
      modules/reports/util/rpt_excel_util.js

+ 8 - 0
modules/reports/util/rpt_excel_util.js

@@ -208,6 +208,9 @@ function writeStyles(stylesObj){
         let textRotation = 0;
         let newHorizontal = excelStyle[JV.CONTROL_PROPS[2]];
         let newVertical = excelStyle[JV.CONTROL_PROPS[3]];
+        if (excelStyle[JV.CONTROL_PROPS[5]]) {
+            newVertical = excelStyle[JV.CONTROL_PROPS[5]];
+        }
         if (parseInt(excelStyle.fontAngle) !== 0) {
             let tmpH = newHorizontal, tmpV = newVertical;
             if (excelStyle.fontAngle > 0) {
@@ -223,6 +226,8 @@ function writeStyles(stylesObj){
                     tmpH = 'right';
                 } else if (newVertical === "bottom") {
                     tmpH = 'left';
+                } else if (newVertical === "justify") {
+                    tmpH = 'justify';
                 } else {
                     tmpH = 'center';
                 }
@@ -273,9 +278,12 @@ function writeSharedString(sharedStrList){
     if (sharedStrList && sharedStrList.length > 0) {
         rst.push(dftHeadXml + '\r\n');
         rst.push('<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="' + sharedStrList.length + '" uniqueCount="' + sharedStrList.length + '">');
+        let regExp = new RegExp("<", "gm");
         for (let i = 0; i < sharedStrList.length; i++) {
             //rst.push('<si><t>' + sharedStrList[i] + '</t></si>');
             if (typeof sharedStrList[i] === 'string') {
+                //转换特殊字符,如 < , 则需要转义一下
+                sharedStrList[i] = sharedStrList[i].replace(regExp, "&lt;");
                 if (sharedStrList[i].indexOf('|') >= 0) {
                     //rst.push('<si><t>' + sharedStrList[i].split('|').join('\r\n') + '</t></si>');
                     rst.push('<si><t>' + sharedStrList[i].split('|').join('\n') + '</t></si>');