Bug 27445

Summary: I get Array index out of range when I inquiry on the cell format of a cell where the style is 165
Product: POI Reporter: dora kinghorn <dora.kinghorn>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P3    
Version: 2.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description dora kinghorn 2004-03-04 17:13:49 UTC
I am reading an Excel file where I need to know if a certain cell contains the 
percentage format. I am using poi-2.5-final-20040302.jar. If you need to 
contact me my phone is 561-241-4180. I wish I could include the file, but I do 
not see a way. Here are the displays when the error occurs:

Cell Type 0
style is 165 cell value 0.016
Exception caught  Array index out of range: 165

Here is the source code I am using:
private void displayCellFormat(HSSFCell cell, int type) {
	System.out.println("Cell Type " + type);
	try {
	      HSSFCellStyle cs = cell.getCellStyle();
	      short format = cs.getDataFormat();
	      if (type == 0) {
		System.out.println("style is " + format + " cell value " + 	
			  		    cell.getNumericCellValue()); 
	      }
	      else {
	        System.out.println("style is " + format + " cell value " + 	
			                    cell.getStringCellValue()); 
	      }	
	      String formatStr = HSSFDataFormat.getBuiltinFormat(format);
	      System.out.println("format " + formatStr); 
	}catch (Exception e) {
		System.out.println("Exception caught  " + e.getMessage()); 
	}				
}

Thanks again. I love the name you gave the package HSSF.

Dora
Comment 1 Rainer Klute 2004-03-04 17:20:54 UTC
The version you use is way out of date. Please try again with a more recent
version of POI.
Comment 2 Rainer Klute 2004-03-04 17:51:08 UTC
Dora pointed out that she by mistake entered the wrong version number in the
"Version" field. I changed it to "2.0FINAL" even though she uses 2.5 - which is
not available in the bugzilla menu.

Okay, so the bug is open for you HSSF guys again. Sorry for the confusion!
Comment 3 Jason Height 2004-09-27 03:02:25 UTC
Dora,

If you could attach the file using the "Create a new attachment" hyperlink then
that would make the job alot easier.

Jason
Comment 4 Jason Height 2006-01-17 10:22:58 UTC
No attachment provided after such a long time. Marking as WONTFix.

Jason