I'm upgrading some code that is currently using POI 2.5 to use POI 3.5. I want 
the code to work with both .xls and .xlsx files, so I'm using 
WorkbookFactory.create(inputStream) to read my Excel file. The program has some 
code to shift all the cells in a row to the right, and I'm having trouble 
converting this code to the new systems of doing things. Here's how it is 
working with version 2.5:

    private void shiftCellsRight(Row r, short firstCellNum, short lastCellNum, 
short distanceToShift) {
        for(short i = lastCellNum; i >= firstCellNum; i--) {
            Cell c = r.getCell(i);
            if(c == null)
                continue;
            c.setCellNum((short)(i + distanceToShift));
        }
    }

The problem is that the setCellNum(short) method doesn't exist in XSSFCell. 
It's also depreciated in HSSFCell, but the replacement method in HSSFRow, 
moveCell(Cell, short), also doesn't exist in XSSFRow. How can I shift cells to 
the right in POI 3.5?

Thanks,

-Steven Tomcavage

--
Steven Tomcavage
Web Developer
Information Technology Services
University of Pennsylvania Law School
215-746-2303
http://www.law.upenn.edu/itsfeedback 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to