Пример #1
0
        public EEWorksheetCell SetCellValue(int row, int column, string value)
        {
            if (row < 1 || row > rowCount)
            {
                return(null);
            }
            if (column < 1 || column > columnCount)
            {
                return(null);
            }
            if (!cells.ContainsKey(row))
            {
                cells[row] = new Dictionary <int, EEWorksheetCell>();
            }
            if (cells[row].ContainsKey(column))
            {
                cells[row][column].value = value;
                return(cells[row][column]);
            }

            var cell = new EEWorksheetCell(row, column, value);

            cells[row][column] = cell;
            return(cell);
        }
Пример #2
0
        /// <summary>
        /// Set cell's value
        /// </summary>
        /// <param name="row">Row of target cell, from 0 to RowCount</param>
        /// <param name="column">Column of target cell, from 0 to ColumnCount</param>
        /// <param name="value">Value of string to set</param>
        public EEWorksheetCell SetCellValue(int row, int column, string value)
        {
            if (row < 0 || column < 0)
            {
                return(null);
            }

            if (RowCount < row)
            {
                RowCount = row + 1;
            }
            if (ColumnCount < column)
            {
                ColumnCount = column + 1;
            }

            Dictionary <int, EEWorksheetCell> targetRow;

            if (!cells.TryGetValue(row, out targetRow))
            {
                targetRow = new Dictionary <int, EEWorksheetCell>();
                cells.Add(row, targetRow);
            }

            EEWorksheetCell targetCell;

            if (!targetRow.TryGetValue(column, out targetCell))
            {
                targetCell = new EEWorksheetCell(row, column, value);
                targetRow.Add(column, targetCell);
            }

            return(targetCell);
        }