public static ExcelPackage CreateEquipmentTemplate() { return(ExcelOptr.CreateExcel(new ExcelConfig() { CreateWorksheetCallBack = (worksheet) => { //定义头 worksheet.Cells[1, 1].Value = "ip"; worksheet.Cells[1, 2].Value = "备注"; } })); }
public static ExcelPackage CreateEquipmentExcel(List <EquipmentDto> eqList) { return(ExcelOptr.CreateExcel(new ExcelConfig() { CreateWorksheetCallBack = (worksheet) => { //定义头 worksheet.Cells[1, 1].Value = "ip"; worksheet.Cells[1, 2].Value = "备注"; for (int i = 0; i < eqList.Count; i++) { worksheet.Cells[i + 2, 1].Value = eqList[i].IpAddressV4; worksheet.Cells[i + 2, 2].Value = eqList[i].Remarks ?? string.Empty; } } })); }