javascript 代码优化
/*-{
var sheet = spread.getActiveSheet();
var style = sheet.getStyle(row, column);
var arr = style.font.split(' ');
var juge = style.font;
var font;
var lenth = arr.length;
if(lenth == 2){
fontStyle = fontStyle + "bold ";
for(var i=0;i<2;i++){
var infontStyle = arr[i];
if(infontStyle.indexOf("px") > 0 && infontStyle.indexOf("/normal") == -1) fontStyle = fontStyle + infontStyle +"/normal ";
if(infontStyle.indexOf("px") > 0 && infontStyle.indexOf("/normal") > 0) fontStyle = fontStyle + infontStyle + " ";
}
}
if(lenth > 2){
if(juge.indexOf("bold") >= 0){
for(var i=0;i 0) fontStyle = fontStyle + "";
if(UseFontStyle.indexOf("px") > 0 && UseFontStyle.indexOf("/normal") == -1) fontStyle = fontStyle + UseFontStyle +"/normal ";
if(UseFontStyle.indexOf("px") > 0 && UseFontStyle.indexOf("/normal") > 0) fontStyle = fontStyle + UseFontStyle + " ";
}
}else{
for(var i=0;i 0 && UseFontStyle.indexOf("/normal") == -1) fontStyle = fontStyle + UseFontStyle +"/normal ";
if(UseFontStyle.indexOf("px") > 0 && UseFontStyle.indexOf("/normal") > 0) fontStyle = fontStyle + UseFontStyle + " ";
}
var insertIndex = fontStyle.indexOf('px')-2;
var part1 = fontStyle.substring(0,insertIndex);
var part2 = "bold ";
var part3 = fontStyle.substring(insertIndex);
fontStyle = part1+part2+part3;
}
}
fontStyle = fontStyle + arr[lenth-1];
style.font = fontStyle;
sheet.setStyle(row,column,style);
}-*/
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
认证0级讲师