public void Execute(Arguments arguments)
 {
     try
     {
         ExcelManager.RemoveInstance();
     }
     catch (Exception ex)
     {
         throw new ApplicationException($"Error occured while closing current excel instance. Message: '{ex.Message}'", ex);
     }
 }
 public void Execute(Arguments arguments)
 {
     try
     {
         ExcelManager.SwitchExcel(arguments.Id.Value);
     }
     catch (Exception ex)
     {
         throw new ApplicationException($"Problem occured while switching to another excel instance. Id: '{arguments.Id.Value}'. Message: '{ex.Message}'");
     }
 }
예제 #3
0
 public void Execute(Arguments arguments)
 {
     try
     {
         ExcelWrapper excelWrapper = ExcelManager.CreateInstance();
         excelWrapper.Open(arguments.Path?.Value, arguments.Sheet?.Value, !arguments.InBackground.Value);
         Scripter.Variables.SetVariableValue(arguments.Result.Value, new Language.IntegerStructure(excelWrapper.Id));
     }
     catch (Exception ex)
     {
         throw new ApplicationException($"Problem occured while opening excel instance. Path: '{arguments.Path.Value}', Sheet: '{arguments.Sheet?.Value}', InBackground: '{arguments.InBackground.Value}'", ex);
     }
 }
예제 #4
0
 public void Execute(Arguments arguments)
 {
     try
     {
         ExcelWrapper excelWrapper = ExcelManager.CreateInstance();
         excelWrapper.Open(arguments.Path?.Value, arguments.Sheet?.Value, !arguments.InBackground.Value);
         Scripter.Variables.SetVariableValue(arguments.Result.Value, new IntegerStructure(excelWrapper.Id));
     }
     catch (Exception ex)
     {
         if (ex.GetType() == typeof(COMException) && ex.Message.Contains("80040154"))
         {
             throw new Exception("Could not find Microsoft Office on computer. Please make sure it is installed and try again.");
         }
         throw new ApplicationException($"Problem occured while opening excel instance. Path: '{arguments.Path?.Value}', Sheet: '{arguments.Sheet?.Value}', InBackground: '{arguments.InBackground.Value}'", ex);
     }
 }
 private void WindowDeactivated(Workbook wb, Microsoft.Office.Interop.Excel.Window wn)
 {
     ExcelManager.RemoveInstance(Id);
     Close();
 }
예제 #6
0
 private void WorkbookBeforeClose(ref bool Cancel)
 {
     ExcelManager.RemoveInstance(Id);
 }