You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Edi <ed...@yahoo.com> on 2007/09/07 07:37:12 UTC

How to get each cell value with it's own name?

Hello to all,

I am newbie of the POI.

We know commonly, Excel file name is A1, B1, C1 and etc......

Using POI, How can I get cell values using A1, B1 (cell names). Please
explain.

Thanking You
Regards,
Edi
-- 
View this message in context: http://www.nabble.com/How-to-get-each-cell-value-with-it%27s-own-name--tf4396245.html#a12536210
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Important question from poi excel reading

Posted by Tahir Akhtar <ta...@spectrum-tech.com>.
You can do something like this

import org.apache.poi.hssf.util.CellReference;

CellReference cellRef=new CellReference("A1")
row=cellRef.getRow()
col=cellRef.getCol()


If I remember correctly the CellReference class is in scratchpad jar.

Regards
Tahir Akhtar
>> Hello to all,
>>
>> I am newbie of the POI.
>>
>> We know commonly, Excel file name is A1, B1, C1 and etc......
>>
>> Using POI, How can I get cell values using A1, B1 (cell names). Please
>> explain.
>>
>> for. eg. My input is A1 and B1. I want to get A1 and B1 cell values.
>>
>> Thanking You
>> Regards,
>> Edi
>>     


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Important question from poi excel reading

Posted by ap...@charter.net.
Edi,

You will need to convert the input you are getting into row and column numbers.  It seems to me that it would be very simple to get the digit from the end of the string, subtract one from it, and that is your row number.  It would also be easy to convert between the alpha characters at the first of the string and a number to get the column number.  A=0, B=1, etc.  You could get the ascii value of the chars and subtract the ascii value of capital A to get the column number.  It will take a little more thought to handle the columns labeled with double chars, but should not be difficult.

I hope this helps,

Marshall
---- Edi <ed...@yahoo.com> wrote: 
> 
> Hello to all,
> 
> I am newbie of the POI.
> 
> We know commonly, Excel file name is A1, B1, C1 and etc......
> 
> Using POI, How can I get cell values using A1, B1 (cell names). Please
> explain.
> 
> for. eg. My input is A1 and B1. I want to get A1 and B1 cell values.
> 
> Thanking You
> Regards,
> Edi
> -- 
> View this message in context: http://www.nabble.com/Important-question-from-poi-excel-reading-tf4396245.html#a12536210
> Sent from the POI - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org