示例#1
0
        /// <summary>
        /// 快速读取xlsx文件
        /// </summary>
        /// <param name="colNums">需要读的列数</param>
        /// <param name="beginRow">开始的行数</param>
        /// <param name="endRow">结束的行数</param>
        /// <param name="userInf">对每一行数据的处理的委托</param>
        public void EasyRead(int[] colNums, int beginRow, int endRow, UseRowValue useValue)
        {
            int beginCol;
            int readCellNum = colNums.Length;

            string[] strs = new string[readCellNum];
            for (int i = beginRow - 1; i < endRow; i++)
            {
                XmlNodeList xRow = ((XmlElement)xRowList[i]).GetElementsByTagName("c");
                beginCol = GetFirstCol('A', xRow);
                for (int resultIndex = 0; resultIndex < readCellNum; resultIndex++)
                {
                    strs[resultIndex] = CellStr(colNums[resultIndex] - beginCol - 1, xRow);
                }
                useValue(strs);
            }
        }
示例#2
0
 /// <summary>
 /// 快速读取xlsx文件
 /// </summary>
 /// <param name="colNums">开始的行数</param>
 /// <param name="userInf">对每一行数据的处理的委托</param>
 public void easyRead(int[] colNums, UseRowValue useValue)
 {
     EasyRead(colNums, 1, xRowList.Count, useValue);
 }