好用的 excel导出导入 C# aspx

 

注:需要影响附件里的,Applibrary.dll

            AppLibrary.WriteExcel.XlsDocument doc = new AppLibrary.WriteExcel.XlsDocument();
            doc.FileName = "Report.xls";
            string SheetName = string.Empty;
            //记录条数
            int mCount = 55;
            //每个SHEET的数量
            int inv = 10;
            //计算当前多少个SHEET
            int k = Convert.ToInt32(Math.Round(Convert.ToDouble(mCount / inv))) + 1;

            for (int i = 0; i < k; i++)
            {
                SheetName = "当前是SHEET" + i.ToString();
                AppLibrary.WriteExcel.Worksheet sheet = doc.Workbook.Worksheets.Add(SheetName);
                AppLibrary.WriteExcel.Cells cells = sheet.Cells;
                //第一行表头
                cells.Add(1, 1, "序号");
                cells.Add(1, 2, "准考证号");
                cells.Add(1, 3, "考生姓名");
                cells.Add(1, 4, "性别");
                cells.Add(1, 5, "报考专业");
                int f = 1;
                for (int m = i * inv; m < mCount && m < (i + 1) * inv; m++)
                {
                    f++;
                    cells.Add(f, 1, f - 1);
                    cells.Add(f, 2, f);
                    cells.Add(f, 3, "woody.wu");
                    cells.Add(f, 4, "男");
                    cells.Add(f, 5, "经济学");
                }
            }
            doc.Send();

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值