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); }
static List <string> GetListString(ISheet sheet, int rowIndex, int colIndex) { List <string> list = new List <string>(); 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.GetStringValue(cell)); } return(list); }
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); }