Exemple #1
0
 public XlsxWriter AddDataValidation(XlsxDataValidation dataValidation)
 {
     return(AddDataValidation(CurrentRowNumber, CurrentColumnNumber, 1, 1, dataValidation));
 }
Exemple #2
0
 public XlsxWriter AddDataValidation(int fromRow, int fromColumn, int rowCount, int columnCount, XlsxDataValidation dataValidation)
 {
     return(DoOnWorksheet(() => _currentWorksheet.AddDataValidation(fromRow, fromColumn, rowCount, columnCount, dataValidation)));
 }
Exemple #3
0
 public XlsxWriter AddDataValidation(int rowCount, int columnCount, XlsxDataValidation dataValidation)
 {
     return(AddDataValidation(CurrentRowNumber, CurrentColumnNumber, rowCount, columnCount, dataValidation));
 }
Exemple #4
0
        public void AddDataValidation(int fromRow, int fromColumn, int rowCount, int columnCount, XlsxDataValidation dataValidation)
        {
            if (rowCount < 1 || columnCount < 1)
            {
                throw new ArgumentOutOfRangeException();
            }
            var cellRef = rowCount > 1 || columnCount > 1
                ? $"{Util.GetColumnName(fromColumn)}{fromRow}:{Util.GetColumnName(fromColumn + columnCount - 1)}{fromRow + rowCount - 1}"
                : $"{Util.GetColumnName(fromColumn)}{fromRow}";

            if (!_cellRefsByDataValidation.TryGetValue(dataValidation, out var cellRefs))
            {
                cellRefs = new List <string>();
                _cellRefsByDataValidation.Add(dataValidation, cellRefs);
            }
            cellRefs.Add(cellRef);
        }