Exemplo n.º 1
0
 public ExcelManager(string filePath, string sheetName = "Data")
 {
     _filePath = filePath;
     excelApp = new Application();
     if (excelApp == null)
         throw new Exception("Excel could not be started.  Check your Office installation.");
     //excelApp.Visible = true; //uncomment to see it being created
     _wb = excelApp.Workbooks.Add(Xl_wbATemplate.xl_wbATWorksheet);
     _ws = (Worksheet)_wb.Worksheets[1];
     if (_ws == null)
         throw new Exception("The workbook could not be created.  Check your Office installation.");
     _ws.Name = sheetName;
     _range = _ws.Used_range;
 }
Exemplo n.º 2
0
 public ExcelManager(string filePath, string sheetName = "Data")
 {
     _filePath = filePath;
     excelApp  = new Application();
     if (excelApp == null)
     {
         throw new Exception("Excel could not be started.  Check your Office installation.");
     }
     //excelApp.Visible = true; //uncomment to see it being created
     _wb = excelApp.Workbooks.Add(Xl_wbATemplate.xl_wbATWorksheet);
     _ws = (Worksheet)_wb.Worksheets[1];
     if (_ws == null)
     {
         throw new Exception("The workbook could not be created.  Check your Office installation.");
     }
     _ws.Name = sheetName;
     _range   = _ws.Used_range;
 }
Exemplo n.º 3
0
 set => SetProperty(ref _range, value);