public IExcelConfiguration HasSheetConfiguration(int sheetIndex, string sheetName, int startRowIndex, bool enableAutoColumnWidth, int?endRowIndex = null) { if (sheetIndex >= 0) { if (SheetSettings.TryGetValue(sheetIndex, out var sheetSetting)) { sheetSetting.SheetName = sheetName; sheetSetting.StartRowIndex = startRowIndex; sheetSetting.AutoColumnWidthEnabled = enableAutoColumnWidth; sheetSetting.EndRowIndex = endRowIndex; } else { SheetSettings[sheetIndex] = new SheetSetting() { SheetIndex = sheetIndex, SheetName = sheetName, StartRowIndex = startRowIndex, AutoColumnWidthEnabled = enableAutoColumnWidth, EndRowIndex = endRowIndex }; } } return(this); }
public IExcelConfiguration HasSheetSetting(Action <SheetSetting> configAction, int sheetIndex = 0) { if (sheetIndex >= 0 && configAction != null) { if (SheetSettings.TryGetValue(sheetIndex, out var sheetSetting)) { configAction.Invoke(sheetSetting); } else { SheetSettings[sheetIndex] = sheetSetting = new SheetSetting(); } configAction.Invoke(sheetSetting); } return(this); }