diff --git a/src/global/getRowlen.js b/src/global/getRowlen.js index 81760d2..441ff49 100644 --- a/src/global/getRowlen.js +++ b/src/global/getRowlen.js @@ -893,154 +893,187 @@ function getCellTextInfo(cell , ctx, option){ } else{ value = value.toString(); - while(i <= value.length){ - let str = value.substring(anchor, i); - let measureText = getMeasureText(str, ctx); - let textWidth = measureText.width; - let textHeight = measureText.actualBoundingBoxAscent+measureText.actualBoundingBoxDescent; - - let width = textWidth * Math.cos(rt*Math.PI/180) + textHeight * Math.sin(rt*Math.PI/180);//consider text box wdith and line height + let splitValue = value.replace(/\r\n/g, "_x000D_").replace(/ /g, "_x000D_").replace(/\r/g, "_x000D_").replace(/\n/g, "_x000D_"); + let splitArr = splitValue.split("_x000D_"); + for(let x=0, len=splitArr.length;xcellHeight && text_all_split[splitIndex]!=null && i!= value.length){ + // console.log("cut",anchor, i , str); - } - // textW_all += textW; - // console.log(str,anchor,i); - if(rt!=0){//rotate - // console.log("all",anchor, i , str); - if((height+space_height)>cellHeight && text_all_split[splitIndex]!=null && i!= value.length){ - // console.log("cut",anchor, i , str); + if(spaceOrTwoByte!=null && spaceOrTwoByte.indexcellWidth && text_all_split[splitIndex]!=null && i!= value.length){ + // console.log(spaceOrTwoByte, i, anchor); + if(spaceOrTwoByte!=null && spaceOrTwoByte.indexcellWidth && text_all_split[splitIndex]!=null && i!= value.length){ - // console.log(spaceOrTwoByte, i, anchor); - if(spaceOrTwoByte!=null && spaceOrTwoByte.index