Example #1
0
        static List <XlCell> ReadRowData(IRow row)
        {
            var cells = new List <XlCell>();

            for (int colIdx = 0; colIdx < 256; colIdx++)
            {
                var cell = row.GetCell(colIdx);
                if (cell == null)
                {
                    if (colIdx > 0)
                    {
                        break;
                    }
                }
                var c = new XlCell();
                c.Value     = GetStringCellValue(row, colIdx);
                c.IsChanged = cell == null ? false : cell.CellStyle.FillForegroundColor == IndexedColors.YELLOW.Index;
                cells.Add(c);
            }
            return(cells);
        }
Example #2
0
        static string GetXlCellValue(XlCell cell, List <XlColumn> schema)
        {
            var    col   = schema.Single(x => x.PhysicalName == cell.Name);
            string value = "";

            switch (col.DataType.ToLower())
            {
            case "varchar2":
            case "nvarchar2":
            case "char":
            case "nchar":
            case "date":
            case "timestamp":
                value = "'" + cell.Value + "'";
                break;

            default:
                value = cell.Value;
                break;
            }
            return(value);
        }