华表 单元格公式设定与计算

来源:互联网 发布:淘宝虚拟试衣功能在哪 编辑:程序博客网 时间:2024/04/29 06:25

本例主要内容为
1.设置Sum()公式 并进行计算
2.设置表格框线
3.合并单元格 并进行对齐设置       
       
document.form1.Cellweb1.ProtectFormula=false;
document.form1.Cellweb1.CalcManaually=true;
var currCol = colNum + 3;
for(var i=3;i<currCol;i++)
{    
      //Sum(A1:A9) 公式的计算范围设定
      var sCell = document.form1.Cellweb1.CellToLabel(i,7);
      var eCell = document.form1.Cellweb1.CellToLabel(i,6+rowNum);
      var str = "Sum("+sCell+":"+eCell+")";             
      var aaa=document.form1.Cellweb1.SetFormula(i,6,0,str);          
}
//公式计算
document.form1.Cellweb1.CalculateAll();
//设置表格框线
document.form1.Cellweb1.DrawGridLine(2,26,2+colNum,6+rowNum,0,2,-1);

//合并单元格    
document.form1.Cellweb1.MergeCells(5,currRow,6,currRow);
//进行单元格赋值
document.form1.Cellweb1.SetCellString(5,currRow,0,"报表人");
//进行对齐设置
document.form1.Cellweb1.SetCellAlign (5,currRow,0,32+2);
document.form1.Cellweb1.MergeCells(7,currRow,8,currRow);
document.form1.Cellweb1.SetCellString(7,currRow,0,UserUpRpt);
document.form1.Cellweb1.SetCellAlign (7,currRow,0,32+1);

原创粉丝点击