4

I am working with .xls file i am going to translate(shift) Rows of excell table to specific position.But got unwanted results everytime.I had already gone through documentation of method shiftRows.Unable to understand working of this statement.

sheet.shiftRows(34, sheet.getLastRowNum(), processIndex-4);

Sometimes it shifted two rows in Excell Table.

  • https://stackoverflow.com/questions/1834971/removing-a-row-from-an-excel-sheet-with-apache-poi-hssf also uses shiftRows and it does not seem to work as one would assume – Wolfgang Fahl Feb 13 '19 at 11:59

1 Answers1

2
        sheet.shiftRows(int startRow, int endRow, int n);

is used to Shift number of rows down the sheet . where

  • startRow =At which we need to insert row .
  • endRows = Total rows
  • n = How much rows we are going to insert

The javadoc for org.apache.poi.ss.usermodel.Sheet.shiftRows provides more details.

Mark Stewart
  • 2,046
  • 4
  • 22
  • 32
manikant gautam
  • 3,521
  • 1
  • 17
  • 27
  • 2
    Would be great if you could link to the [javadocs for the method](https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Sheet.html#shiftRows%28int,%20int,%20int%29) in your answer! – Gagravarr Mar 04 '16 at 16:19
  • Parameter description is as below `startRow - the row to start shifting` `endRow - the row to end shifting` `n - the number of rows to shift` – Ankur Raiyani Aug 26 '21 at 05:15