Nick,

  you are right we were using HSSF and we upgraded to poi 3.7 and changed
the code to SS user model so that it takes both XSSF and HSSF.

  Here is the code I am using.Suppose when shiftRows()  is done  for 2 rows
to shift down,ie from 47 to 49, then current row is showing 49 and if I want
to start writing the content from 47, I am not able to read the row at 47
and it coming out as null. thus happened to create a row at 47 again.

if (rowsneeded > 0) { // suppose rowsneeded is 2 and row.getRowNum() is 47      
  
sheet.shiftRows(row.getRowNum() , sheet.getLastRowNum(), rowsneeded);
}
Above code will shift two rows , initially when sheet.getRowNum() is 47,
after shifting the rows, row is showing as 49, as I want to start writing
the content from 47, I have to go to back to 47, but when I say  row =
sheet.getRow(row.getRowNum() - rowsneeded); which is 49-2 = 47,  47th row is
coming out as null , I happen to create a row again at 47 to write the
content before starting the iterator , why 47th row is coming out as null
after shifting the rows?

                  // I added this following line before starting for loop
                                row = sheet.createRow(row.getRowNum() - 
rowsneeded);
                for (Iterator it = item.getTrlEntries().iterator(); 
it.hasNext();) {
                        
                        entry = (L2DevelopmentPlan)it.next();                   
        
                        formatCells(row, entry, sheet);
                         }
                        

I will post the the xml error soon which comes while loading excel.

-- 
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/POI-3-7-sheet-shiftRows-corrupted-the-cells-tp3375735p3375934.html
Sent from the POI - User mailing list archive at Nabble.com.

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

Reply via email to