Writing an Excel file in EPPlus

前端 未结 3 1742
青春惊慌失措
青春惊慌失措 2021-01-31 17:45

I have been stuck on this for days and despite all of the help out there, none of these solutions have been working for me. What I want to do is create an excel file using the E

3条回答
  •  野的像风
    2021-01-31 18:15

    If you have a collection of objects that you load using stored procedure you can also use LoadFromCollection.

    using (ExcelPackage package = new ExcelPackage(file))
    {
        ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("test");
    
        worksheet.Cells["A1"].LoadFromCollection(myColl, true, OfficeOpenXml.Table.TableStyles.Medium1);
    
        package.Save();
    }
    

提交回复
热议问题