IRow row = sheet.GetRow(i);

坑:如果此行存在空的cell,则row.Cells[index] 不能获取到,空的单元格不能生成cells 

 

        /// <summary>
        /// 获取这一列的某个Cell
        /// </summary>
        /// <param name="Row"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public ICell GetCell(IRow Row, int index)
        {
            ICell cell = Row.FirstOrDefault(n => n.ColumnIndex == index);
            if (cell == null)
            {
                cell = Row.CreateCell(index);
            } 
            return cell;
        }

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-04-20
猜你喜欢
  • 2021-11-01
  • 2022-01-04
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案