You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Akash jain <he...@gmail.com> on 2014/01/07 08:21:07 UTC

read a HSSFCell value

Hello ,
I am struck in a problem i.e. how to read a HSSFCell value if that cell
contains drop down List?

Please Reply.




--
View this message in context: http://apache-poi.1045710.n5.nabble.com/read-a-HSSFCell-value-tp5714592.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: read a HSSFCell value

Posted by 山本 亮 <ry...@yjk.co.jp>.
Correction.  As with a cell without a drop-down list, you can use getXXXCellValue method to the selected value.

  HSSFSheet sheet = workbook.getSheetAt(0);

  HSSFCell stringCell = sheet.getRow(0).getCell(0); // a string cell with a drop-down list
  String stringValue = stringCell.getStringCellValue();

  HSSFCell numericCell = sheet.getRow(0).getCell(1); // a numeric cell with a drop-down list
  double numericValue = numericCell.getNumericCellValue();

I use POI 3.9.

Ryo Yamamoto
-----Original Message-----
From: 山本 亮 [mailto:ryamamoto@yjk.co.jp] 
Sent: Wednesday, January 08, 2014 10:10 AM
To: POI Users List
Subject: RE: read a HSSFCell value

You can use getStringCellValue method to get the selected value.  Here is my sample code.

  HSSFSheet sheet = workbook.getSheetAt(0);
  HSSFCell cell = sheet.getRow(0).getCell(0); // a cell with a drop-down list
  String value = cell.getStringCellValue();

I use POI 3.9.

Ryo Yamamoto
-----Original Message-----
From: Akash jain [mailto:heroakashjain@gmail.com]
Sent: Tuesday, January 07, 2014 4:21 PM
To: user@poi.apache.org
Subject: read a HSSFCell value

Hello ,
I am struck in a problem i.e. how to read a HSSFCell value if that cell contains drop down List?

Please Reply.




--
View this message in context: http://apache-poi.1045710.n5.nabble.com/read-a-HSSFCell-value-tp5714592.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


---------------------------------------------------------------------
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


RE: read a HSSFCell value

Posted by 山本 亮 <ry...@yjk.co.jp>.
You can use getStringCellValue method to get the selected value.  Here is my sample code.

  HSSFSheet sheet = workbook.getSheetAt(0);
  HSSFCell cell = sheet.getRow(0).getCell(0); // a cell with a drop-down list
  String value = cell.getStringCellValue();

I use POI 3.9.

Ryo Yamamoto
-----Original Message-----
From: Akash jain [mailto:heroakashjain@gmail.com] 
Sent: Tuesday, January 07, 2014 4:21 PM
To: user@poi.apache.org
Subject: read a HSSFCell value

Hello ,
I am struck in a problem i.e. how to read a HSSFCell value if that cell contains drop down List?

Please Reply.




--
View this message in context: http://apache-poi.1045710.n5.nabble.com/read-a-HSSFCell-value-tp5714592.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


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