public ExcelHelper(string fileName, bool editable = true, int header = 1) { if (string.IsNullOrEmpty(fileName)) { throw new Exception("Check if current filename is empty!"); } if (!File.Exists(fileName)) { throw new Exception("Please make sure current file exists!"); } document = SpreadsheetDocument.Open(fileName, editable); worksheet = document.GetWorksheet(0); sheetData = worksheet.GetSheetData(); styleSheet = document.GetStylesheet(); this.Header = header; this.cellFormatOption = CellFormatOption.OverWrite; }
public void SetActiveSheet(string sheetName) { this.Save(); this.worksheet = document.GetWorksheet(sheetName); this.sheetData = worksheet.GetSheetData(); }
public void SetActiveSheet(int index) { this.Save(); this.worksheet = document.GetWorksheet(index); this.sheetData = worksheet.GetSheetData(); }