Esempio n. 1
0
        //批量获取,from 到to,不包括to
        public List <SheetInfo> getSheetInfo_Range(int from, int to)
        {
            if (from < 0 || to < from || to > this.getSheetCount())//错误
            {
                throw new Exception("超出边界");
            }
            GetSheetInfo function = null;

            switch (excelType)
            {
            case ExcelType.BaseExcel:
            case ExcelType.WallExcel: function = getSheetInfo_BaseOrWall; break;

            case ExcelType.DataExcel: function = getSheetInfo_Data; break;

            case ExcelType.None: throw new Exception("还没有指定阅读模式");
            }
            List <SheetInfo> listSheetInfo = new List <SheetInfo>();

            for (int i = from; i < to; i++)
            {
                ResetData();//重置sheetInfo
                SheetInfo sheet = function(i);
                if (sheet == null)
                {
                    break;
                }
                listSheetInfo.Add(sheet);
            }
            return(listSheetInfo);
        }
Esempio n. 2
0
 //重置sheetInfo
 private void ResetData()
 {
     sheetInfo = new SheetInfo();
 }
Esempio n. 3
0
 //
 //
 public ExcelReader()
 {
     sheetInfo = new SheetInfo();
     excel     = new ExcelHelper();
 }
Esempio n. 4
0
 public void Close()  //关闭
 {
     excel     = null;
     sheetInfo = null;
 }