好用的 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();

你可能感兴趣的:(String,Excel,C#)