The row number wraps around for higher row numbers (>65535). <code> HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("65536"); HSSFRow row = sheet.createRow((short)65536); HSSFCell cell = row.createCell((short)0); cell.setCellValue(65536); </code> The above code sets the value in the cell A1. [due to the cast (short)65536] Shouldn't the behavior be similar to row.createCell((short)256) - which throws an exception? cheers Conrad
In this case it seems that it's Java wrapping the value. (short)256 = 256 because short is 16 bits. (short)65536 = 0 because only the last 16 bits of the value are being used.
Unless we change the API to use ints for the row numbers, this wont be fixed. As Glen points out this is a java vm behaviour. Jason