예제 #1
0
        /// <summary>
        /// Sets the excel styler and other injections needed
        /// </summary>
        /// <param name="excelData">The excel package and worksheet</param>
        /// <param name="excelStyler">The excel class to add styling to cells</param>
        /// <param name="dictionaryManager">Dictionary manager to get config dictionaries</param>
        /// <param name="logger">Logger to record messages</param>
        public ExcelFormatter(IExcelData excelData, IExcelStyler excelStyler, IDictionaryManager dictionaryManager
                              , ILogger <ExcelFormatter> logger)
        {
            _worksheet = excelData.Worksheet;
            _package   = excelData.Package;
            _styler    = excelStyler;
            _logger    = logger;

            // dictionary for null cells
            _nullCellDictionary = dictionaryManager.GetIntDictionary("NullColumns");
            if (_nullCellDictionary == null)
            {
                const string error = "The dictionary for columns is null. Ensure the configuration file is correct";
                _logger.LogError(error);
                throw new NullReferenceException(error);
            }

            // dictionary for incorrect date times
            _columnDateTimeDictionary = dictionaryManager.GetIntDictionary("IncorrectTimeColumns");
            if (_columnDateTimeDictionary == null)
            {
                const string error = "The dictionary for before check columns is null. Ensure the configuration file is correct";
                _logger.LogError(error);
                throw new NullReferenceException(error);
            }
        }
 protected BaseExcelWriter(IExcelData excelData, IExcelStyler excelStyler)
 {
     _excelData   = excelData;
     _excelStyler = excelStyler;
 }
예제 #3
0
 public ExcelWriter(IExcelData excelData, IExcelStyler excelStyler) : base(excelData, excelStyler)
 {
 }