Bug 43008

Summary: HSSFCell.setCellNum() works incorrectly.
Product: POI Reporter: Bina Prieto <Bina>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P3    
Version: 3.0-FINAL   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Bina Prieto 2007-08-01 06:19:27 UTC
 
Comment 1 Bina Prieto 2007-08-01 06:25:33 UTC
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet();
HSSFRow row = sheet.createRow((short) 0);
HSSFCell cell = row.createCell((short) 0);
cell.setCellNum((short) 1);
// I think that I have here the came cell as by cell reference
// but cell1 is null reference
HSSFCell cell1 = row.getCell((short) 1);
short cellNum = cell1.getCellNum();

Run this code. We've got NPE but I think that row.getCell((short) 1); operator
should return created cell because we chaged cell number (that means "column" 
number) and now created cell number is 1! row.getCell((short) 0) should return 
null now.
in cell.setCellNum((short) 1); operator.
Comment 2 Nick Burch 2008-01-09 06:28:59 UTC
HSSFCell.setCellNum() was really just setting things in the raw record, and not
touching the row, which is why you were seeing what you were

I've deprecated the method, and added a moveCell method to HSSFRow. That ought
to work as you'd expect. (It's in svn trunk now)