You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by shankarrao <sh...@gmail.com> on 2011/01/14 16:43:40 UTC

Retrieving the Cell Contents

Could you please let me know how to retrieve the Cell address? i.e. say my
cell address is B2.. How do i retrieve the contents of this Cell. is there a
method sheet.getCell(column, row)? Please let me know your inputs.

-Shankar
-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Retrieving-the-Cell-Contents-tp3341469p3341469.html
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: Retrieving the Cell Contents

Posted by shankarrao <sh...@gmail.com>.
Thanks for your reply, Mark.

-Shankar
-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Retrieving-the-Cell-Contents-tp3341469p3343370.html
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: Retrieving the Cell Contents

Posted by Mark Beardsley <ma...@tiscali.co.uk>.
There is no way within POI to simple say bet me the contents of cell B2.
Instead, the mechanism is to recover a reference to a row from the sheet and
then to the specific cell from that row object. There is a way to convert
from Excel's cell references to POI's; all you ned to do is use the
CellReference class -
http://poi.apache.org/apidocs/org/apache/poi/hssf/util/CellReference.html.

It is most common to iterate through the contents of a worksheet and this
example explains how to do that -
http://poi.apache.org/spreadsheet/quick-guide.html#CellContents. Perhaps the
most valuable part of that example is the switch clause that determines the
cell's type and calls the appropriate method to recover it's contents. Note
also that this approach eschews using indexs and ijnstaed employs the
Iterators that can be obtained for both row and cell.

Yours

Mark B
-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/Retrieving-the-Cell-Contents-tp3341469p3342406.html
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