日期:2014-05-17  浏览次数:20894 次

C# 技术 怎样判断Excel 表格里面的某行有内容
c# 操作 Excel表格,怎样判断Excel 中 sheet1 的任意一行 中有内容!!求高手!

------解决方案--------------------
可以使用NPOI轻量级的组件来读取Excel。
http://tonyqus.sinaapp.com/npoi2tutorial
http://www.cnblogs.com/linzheng/archive/2010/12/20/1912137.html
------解决方案--------------------
http://www.dzwebs.net/3645.html
------解决方案--------------------
http://www.cnblogs.com/wangzhisheng/p/3417051.html
------解决方案--------------------
http://www.cr173.com/html/18143_all.html
------解决方案--------------------
http://blog.csdn.net/redder_xu/article/details/6753418
------解决方案--------------------
需要用到第三方程序集Aspose,你可以在网上下一个
这个程序集可以再没安装OFFICE的PC上读取OFFICE文档。
代码如下:

  Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
  workbook.Open("C:\\Users\\Administrator\\Desktop\\TEST.xlsx");

  Aspose.Cells.Worksheet sheet = workbook.Worksheets[0];

  try
  {
       label1.Text = sheet.Cells[1, 0].Value.ToString();
  }
  catch { label1.Text = "null"; }