Esempio n. 1
0
    public void ExportExcel()
    {
        PerformanceHelper ph = new PerformanceHelper();

        ph.Start("取数时间");
        var list = YK.Service.AdminService.LogService.Search();

        ph.Stop();
        ph.Start("导出时间");
        var teamplatePath = Server.MapPath("~/老客户列表.xlsx");
        var savePath1     = Server.MapPath("~/products1.xlsx");
        var savePath2     = Server.MapPath("~/products2.xlsx");
        var savePath3     = Server.MapPath("~/products3.xlsx");
        var savePath4     = Server.MapPath("~/products4.xlsx");
        var savePath5     = Server.MapPath("~/products5.xlsx");
        var savePath6     = Server.MapPath("~/products6.xlsx");

        YK.Common.Excel.ExcelHelper helper = new YK.Common.Excel.ExcelHelper();
        helper.DataRowStart    = 2;
        helper.DataColumnStart = 0;

        helper.Export(list.Skip(20000 * 0).Take(20000), teamplatePath, savePath1);
        helper.Export(list.Skip(20000 * 1).Take(20000), teamplatePath, savePath2);
        helper.Export(list.Skip(20000 * 2).Take(20000), teamplatePath, savePath3);
        helper.Export(list.Skip(20000 * 3).Take(20000), teamplatePath, savePath4);
        helper.Export(list.Skip(20000 * 4).Take(20000), teamplatePath, savePath5);
        helper.Export(list.Skip(20000 * 5).Take(20000), teamplatePath, savePath6);

        ph.Stop();
    }
Esempio n. 2
0
    public void ExportExcel(object obj)
    {
        int i             = Convert.ToInt32(obj);
        var teamplatePath = Server.MapPath("~/老客户列表.xlsx");
        var savePath      = Server.MapPath("~/products" + i + ".xlsx");

        YK.Common.Excel.ExcelHelper helper = new YK.Common.Excel.ExcelHelper();
        helper.DataRowStart    = 2;
        helper.DataColumnStart = 0;
        helper.Export(list.Skip(20000 * (i - 1)).Take(20000), teamplatePath, savePath);
    }