예제 #1
0
        /// <summary>
        /// Gets the string.
        /// </summary>
        /// <param name="cell">The cell.</param>
        /// <param name="sharedStringTable">The shared string table.</param>
        /// <returns></returns>
        public static string GetString(this Cell cell, SharedStringTable sharedStringTable)
        {
            string value = cell?.CellValue?.Text;

            if (value == null)
            {
                return(null);
            }

            if ((sharedStringTable != null) && (cell.DataType?.Value == CellValues.SharedString))
            {
                value = sharedStringTable
                        .OfType <SharedStringItem>()
                        .Skip(Convert.ToInt32(value))
                        .FirstOrDefault()?
                        .InnerText;
            }

            return(value);
        }