如何使用apache poi获取A1(单元格地址)的单元格值3.6

问题描述:

我有像A1,A2一样的Excel单元格地址。那么,如何访问此细胞编程方式使用poi3.6如何使用apache poi获取A1(单元格地址)的单元格值3.6

另一种方式是

row=mySheet.getRow(); 
cell=row.getCell(); 

但是我对A1的格式的地址...所以,我怎么编程访问这些细胞

CellReference cr = new CellReference("A1"); 
row = mySheet.getRow(cr.getRow()); 
cell = row.getCell(cr.getCol()); 

更多的样本见Quick Guide

+0

感谢Neeme ...... – Saravanan 2010-11-25 12:02:40

有一个单元格引用函数

例如

CellReference cellReference = new CellReference(“B3”);

(从这里example拍摄)

using System; 
using System.Collections.Generic; 
using System.Text; 
using System.Threading.Tasks; 

namespace test 
{ 
    class Program 
    { 
     static void Main(string[] ar) 
     { 
      // char a = 'A', b = 'B'; 
      //string[] ab = new string[100]; 
      //ab[0]= "A1"; 
      int k = 0, h = 0; ; 
      string ab = "B1"; 
      int l; 
      l = Convert.ToInt32(ab.Length.To String()); 

      for (int i = 0; i < l; i++) 
      { 
       if(!char.Is Digit(ab[i])) 
       { 
       for (int j = 65; j <= 90; j++) 
       { 
       if(Convert.ToInt32(ab[i])==j) 
        { 
         break; 
        } 
       else 
        { 
         k = 1-k; 
        } 

       } 

      } 
       else 
       { 
        h = (Convert.ToInt32(ab[i]))-49; 

       } 
       } 

      Console.Write Line(l); 
      Console.Write Line(h+""+k); 



     } 
    }} 

替代变量“AB”作为您的Excel单元格地址