示例#1
0
        /// <summary>
        /// Gets a cell if exists in the worksheet. Returns null if cell does not exist.
        /// </summary>
        /// <param name="sheetData">The sheet data.</param>
        /// <param name="columnIndex">Index of the column.</param>
        /// <param name="rowIndex">Index of the row.</param>
        /// <returns></returns>
        public static Cell GetCellIfExists(this SheetData sheetData, uint columnIndex, uint rowIndex)
        {
            Row row = GetRowIfExists(sheetData, rowIndex);

            if (row != null)
            {
                string cellReference = CellExtensions.GetCellReference(columnIndex, rowIndex);
                return(row.OfType <Cell>().FirstOrDefault(c => c.CellReference == cellReference));
            }
            return(null);
        }