DataExcel 设置 函数

来源:互联网 发布:linux qt 中文不显示 编辑:程序博客网 时间:2024/06/05 16:50


DataExcel 设置 函数


        public void SetFunction()        {            ///清除所有行,列,合并单元格,扩展单元格,等            dataexcel1.Clear();            ///初始化默认行,列            dataexcel1.Init();            ICell cell = null;            for (int i = 1; i < 6; i++)            {                for (int j = 1; j < 5; j++)                {                    cell = dataexcel1[i, j];                    cell.Value = i + j;                }            }            dataexcel1[6, 1].Expression = "\"合计:\"&sum(a1:a5)";//& 表示把两个字符串连接到一起            dataexcel1[6, 2].Expression = "\"平均:\"&avg(b1:b5)";            dataexcel1[6, 3].Expression = "\"数量:\"&count(c1:c5)";            dataexcel1.Save(dataexcel1.Version + "_" + DateTime.Now.ToString("yyMMddHHmmss") + (fileindex++).ToString().PadLeft(4, '0') + ".dat");        }