Exemple #1
0
        public static object GetCellValue(ICell cell, ExcelDataType dataType)
        {
            switch (dataType)
            {
            case ExcelDataType.Int:
                return(EDReadHelper.GetIntValue(cell));

            case ExcelDataType.Float:
                return(EDReadHelper.GetFloatValue(cell));

            case ExcelDataType.Long:
                return(EDReadHelper.GetLongValue(cell));

            case ExcelDataType.Double:
                return(EDReadHelper.GetDoubleValue(cell));

            case ExcelDataType.Boolean:
                return(EDReadHelper.GetBoolValue(cell));

            case ExcelDataType.String:
                return(EDReadHelper.GetStringValue(cell));

            case ExcelDataType.Array:
            default:
                break;
            }
            return(null);
        }
Exemple #2
0
        static List <bool> GetListBool(ISheet sheet, int rowIndex, int colIndex)
        {
            List <bool> list = new List <bool>();

            for (int i = sheet.FirstRowNum + rowIndex; i <= sheet.LastRowNum; ++i)
            {
                IRow  row  = sheet.GetRow(i);
                ICell cell = row.GetCell(row.FirstCellNum + colIndex);
                list.Add(EDReadHelper.GetBoolValue(cell));
            }
            return(list);
        }
Exemple #3
0
        public static object GetCellValue(ICell cell, Field field)
        {
            if (cell != null)
            {
                switch (field.type)
                {
                case ExcelDataType.Int:
                    return(EDReadHelper.GetIntValue(cell));

                case ExcelDataType.Float:
                    return(EDReadHelper.GetFloatValue(cell));

                case ExcelDataType.Long:
                    return(EDReadHelper.GetLongValue(cell));

                case ExcelDataType.Double:
                    return(EDReadHelper.GetDoubleValue(cell));

                case ExcelDataType.Boolean:
                    return(EDReadHelper.GetBoolValue(cell));

                case ExcelDataType.String:
                    return(EDReadHelper.GetStringValue(cell));

                case ExcelDataType.List:
                    return(EDLinkDataReader.GetLinkData(cell, field.ExtTypeToSystemType()));

                case ExcelDataType.Array:
                    return(EDLinkDataReader.GetLinkArray(cell, field.ExtTypeToSystemType()));

                case ExcelDataType.Dictionary:
                    return(EDLinkDataReader.GetLinkDict(cell, field.extTypeKeyField, field.extType.IndexOf("RemoveKey") > -1));

                default:
                    break;
                }
            }
            return(null);
        }