Thanks
I solved it last night! I found shiftRows method, but please care that first
shift rows and then insert new rows:

       switch (position) {
           case StaticValues.TOP_POSITION:
               int diff = rowId - numberRows;
               if (diff > -1)
                   hssfSheet.shiftRows(rowId, diff, 1);
               else
                   hssfSheet.shiftRows(rowId, 0, 0);
               break;

           case StaticValues.DOWN_POSITION:
               hssfSheet.shiftRows(rowId, rowId + numberRows, 1);
               break;
       }

       HSSFRow hssfRow = hssfSheet.createRow(rowId);


On 7/23/07, Anthony Andrews <[EMAIL PROTECTED]> wrote:

Must admit that I have never tried to do this, but I think that you need
to call the shiftRows() method first to move all of the rows below the one
you wish to insert and then you can create the new row - by calling the
createRow() method.

Amir Hossein Sharifzadeh <[EMAIL PROTECTED]> wrote: Hi All
I am using POI, I want to insert a row between two rows in an Excel File,
for example I have 10 rows and I am going to insert a row between 4'th and
5'th.
I wrote these codes for this purpose:
HSSFRow hssfRow = hssfSheet.createRow(5)

There is a problem, I lost my past row! (row 5'th). I am looking for a
solution for keeping past row or rows after inserting new row(s).
Thanks a lot



---------------------------------
Ready for the edge of your seat? Check out tonight's top picks on Yahoo!
TV.

Reply via email to