Пример #1
0
        protected override string[] Execute(CodeActivityContext context)
        {
            if (UseScope)
            {
                return(ExecuteWithScope(context));
            }

            var path = WorkbookPath.Get(context);

            if (!File.Exists(path))
            {
                throw new FileNotFoundException(path);
            }

            IWorkbookAdapter workbook = null;

            try
            {
                workbook = WorkbookAdapterFactory.Create(path);
                return(Execute(context, workbook));
            }
            catch (Exception e)
            {
                System.Diagnostics.Trace.WriteLine(e.Message);
                throw;
            }
            finally
            {
                workbook?.Dispose();
            }
        }
        protected override int Execute(CodeActivityContext context)
        {
            if (UseScope)
            {
                return(ExecuteWithScope(context));
            }

            var path = WorkbookPath.Get(context);

            if (!File.Exists(path))
            {
                throw new FileNotFoundException(path);
            }

            IWorkbookAdapter workbook = null;

            try
            {
                workbook = WorkbookAdapterFactory.Create(path);
                return(Execute(context, workbook));
            }
            catch (Exception)
            {
                return(-1);
            }
            finally
            {
                workbook?.Dispose();
            }
        }
Пример #3
0
        protected override string[] Execute(CodeActivityContext context)
        {
            if (UseScope)
            {
                return(ExecuteWithScope(context));
            }

            IWorkbookAdapter workbook = null;

            try
            {
                var filePath = WorkbookPath.Get(context);
                workbook = WorkbookAdapterFactory.Create(filePath);
                return(workbook.GetSheetNames());
            }
            finally
            {
                workbook?.Dispose();
            }
        }