Ejemplo n.º 1
0
        public static ExcelWrapper CreateInstance()
        {
            int          assignedId = GetNextId();
            ExcelWrapper wrapper    = new ExcelWrapper(assignedId);

            launchedExcels.Add(wrapper);
            CurrentExcel = wrapper;
            return(wrapper);
        }
Ejemplo n.º 2
0
        public static void SwitchExcel(int id)
        {
            ExcelWrapper instanceToSwitchTo = launchedExcels.Where(x => x.Id == id).FirstOrDefault();

            if (instanceToSwitchTo == null)
            {
                throw new ArgumentException($"No excel instance found with id: {id}");
            }
            CurrentExcel = instanceToSwitchTo;
        }
Ejemplo n.º 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);
     }
 }