| | |
| | | compStyle = getComputedStyle(q); |
| | | additionalStyles += (compStyle && compStyle.backgroundColor ? "background-color: " + compStyle.backgroundColor + ";" : ""); |
| | | additionalStyles += (compStyle && compStyle.color ? "color: " + compStyle.color + ";" : ""); |
| | | additionalStyles += (compStyle && compStyle.wordWrap ? "word-wrap: " + compStyle.wordWrap + ";" : ""); |
| | | } |
| | | |
| | | var rc = { |
| | |
| | | if( rc.flag.length > 0 ) { |
| | | tempRows += "<td> </td>"; // exclude it!! |
| | | } else { |
| | | tempRows += "<td"; |
| | | // 匹配格式为'yyyy-mm'的日期字符串数据,若有其他需求后期再增加 |
| | | var regexPattern = /^\d{4}-\d{2}$/; |
| | | if($(q).html().match(regexPattern)){ |
| | | tempRows += "<td style=\"mso-number-format:'yyyy-mm';\""; |
| | | }else{ |
| | | tempRows += "<td"; |
| | | if(additionalStyles){ |
| | | tempRows += " style='" + additionalStyles + "'"; |
| | | } |
| | | } |
| | | if( rc.rows > 0) { |
| | | tempRows += " rowspan='" + rc.rows + "' "; |
| | | } |
| | | if( rc.cols > 0) { |
| | | tempRows += " colspan='" + rc.cols + "' "; |
| | | } |
| | | if(additionalStyles){ |
| | | tempRows += " style='" + additionalStyles + "'"; |
| | | } |
| | | tempRows += ">" + $(q).html() + "</td>"; |
| | | } |