Beispiel #1
0
 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;
 }
Beispiel #2
0
 public void SetActiveSheet(string sheetName)
 {
     this.Save();
     this.worksheet = document.GetWorksheet(sheetName);
     this.sheetData = worksheet.GetSheetData();
 }
Beispiel #3
0
 public void SetActiveSheet(int index)
 {
     this.Save();
     this.worksheet = document.GetWorksheet(index);
     this.sheetData = worksheet.GetSheetData();
 }