コード例 #1
0
 public ExcelRunner(string filename, ExcelInputSource source, ExcelReader.ExcelReader reader, ExcelListOptions options)
 {
     _fileName = filename;
     _source   = source;
     _reader   = reader;
     _options  = options;
 }
コード例 #2
0
        private static ExcelRunner GetRunner(IConfiguration configuration)
        {
            string file = configuration["ExcelInputFile"];

            if (!Enum.TryParse(configuration["ExcelInputSource"], out ExcelInputSource source))
            {
                throw new ArgumentException("InputFileSource not specified!");
            }

            if (!int.TryParse(configuration["List1Column"], out int firstColumn) ||
                !int.TryParse(configuration["List2Column"], out int secondColumn))
            {
                throw new ArgumentException("Wrong specified list columns.");
            }

            var options = new ExcelListOptions
            {
                FirstListColumn  = firstColumn,
                SecondListColumn = secondColumn
            };

            return(new ExcelRunner(file, source, new ExcelReader.ExcelReader(), options));
        }