public class ExcelExportHelper
{
private XSSFWorkbook ExcelBook { get; set; }
private FileStream fileStream { get; set; }
private ISheet CurrentSheet { get; set; }
private ICellStyle cellStyle { get; set; }
/// <summary>
/// 获取数据
/// </summary>
/// <param name="tableName">输出表名称</param>
/// <param name="list">分页对象</param>
/// <param name="tempPath">模板文件</param>
/// <param name="row">数据起始行</param>
/// <returns></returns>
public static ExcelExportHelper ByItems(string tableName, IEnumerable<object> list, string tempPath = "/Asset/Template.xlsx", int row = 2)
{
var path = tempPath == "/Asset/Template.xlsx" ? Directory.GetCurrentDirectory() + tempPath : tempPath;
var excel = new ExcelExportHelper(path);
C# 使用 NPOI 导出Linq的列表数据
于 2022-09-21 14:43:17 首次发布