Пример #1
0
        object ReadListData(ISheet sheet, int colIndex, int startRow, int endRow, TypeInfo t)
        {
            switch (t.sign)
            {
            case TypeInfo.Sign.Byte:
                return(ReadList <byte>(sheet, colIndex, startRow, endRow, t));

            case TypeInfo.Sign.Int:
                return(ReadList <int>(sheet, colIndex, startRow, endRow, t));

            case TypeInfo.Sign.Float:
                return(ReadList <float>(sheet, colIndex, startRow, endRow, t));

            case TypeInfo.Sign.Long:
                return(ReadList <long>(sheet, colIndex, startRow, endRow, t));

            case TypeInfo.Sign.Double:
                return(ReadList <double>(sheet, colIndex, startRow, endRow, t));

            case TypeInfo.Sign.Boolean:
                return(ReadList <bool>(sheet, colIndex, startRow, endRow, t));

            case TypeInfo.Sign.String:
                return(ReadList <string>(sheet, colIndex, startRow, endRow, t));

            default:
                Schema schema = SchemaReader.ReadSchema(sheet, headModel);
                return(ReadList(sheet, schema, startRow, endRow));
            }
        }
Пример #2
0
        public object ReadLinkObject(ICell cell, TypeInfo t)
        {
            if (cell == null || cell.StringCellValue == "")
            {
                return(null);
            }
            string       linkWhere = cell.StringCellValue;
            CellPosition cp;
            string       linkSheetName = ReadLinkHelper.ParseLinkCell(cell, out cp);

            if (cp.rowEnd <= 0)
            {
                cp.rowEnd = cp.rowStart;
            }

            ISheet linkSheet = cell.Sheet.Workbook.GetSheet(linkSheetName);
            Schema schema    = SchemaReader.ReadSchema(linkSheet, headModel);

            //内容要跳过头
            return(ReadList(linkSheet, schema, cp.rowStart, cp.rowEnd, cp.colStart, cp.colEnd + 1, null)[0]);
        }
Пример #3
0
        public object ReadLinkDict(ICell cell, string keyField = null, bool removeKeyFieldInElement = false)
        {
            if (cell == null || cell.StringCellValue == "")
            {
                return(null);
            }
            string       linkWhere = cell.StringCellValue;
            CellPosition cp;
            string       cellKey;
            string       linkSheetName = ReadLinkHelper.ParseLinkCell(cell, out cp, out cellKey);

            if (string.IsNullOrEmpty(keyField))
            {
                keyField = cellKey;
            }

            ISheet linkSheet = cell.Sheet.Workbook.GetSheet(linkSheetName);
            Schema schema    = SchemaReader.ReadSchema(linkSheet, headModel);

            //内容要跳过头
            return(ReadDictionary(linkSheet, schema, keyField, cp.rowStart, cp.colStart, cp.colEnd + 1, null, removeKeyFieldInElement, cp.rowEnd));
        }