Examples of shiftRows()


Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

    Workbook wb = XSSFTestDataSamples.openSampleWorkbook("53798.xlsx");

    Sheet testSheet  = wb.getSheetAt(0);
    // 1) corrupted xlsx (unreadable data in the first row of a shifted group) already comes about 
    // when shifted by less than -1 negative amount (try -2)
    testSheet.shiftRows(3, 3, -2);
   
    Row newRow = null; Cell newCell = null;
    // 2) attempt to create a new row IN PLACE of a removed row by a negative shift causes corrupted
    // xlsx file with  unreadable data in the negative shifted row.
    // NOTE it's ok to create any other row.
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

    // 3) once a negative shift has been made any attempt to shift another group of rows
    // (note: outside of previously negative shifted rows) by a POSITIVE amount causes POI exception:
    // org.apache.xmlbeans.impl.values.XmlValueDisconnectedException.
    // NOTE: another negative shift on another group of rows is successful, provided no new rows in 
    // place of previously shifted rows were attempted to be created as explained above.
    testSheet.shiftRows(6, 7, 1)// -- CHANGE the shift to positive once the behaviour of 
                    // the above has been tested
   
    //saveReport(wb, new File("/tmp/53798.xlsx"));
    Workbook read = XSSFTestDataSamples.writeOutAndReadBack(wb);
    assertNotNull(read);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

 
  public void testBug53798a() throws IOException {
    Workbook wb = XSSFTestDataSamples.openSampleWorkbook("53798.xlsx");

    Sheet testSheet  = wb.getSheetAt(0);
    testSheet.shiftRows(3, 3, -1);
        for (Row r : testSheet) {
          r.getRowNum();
        }
    testSheet.shiftRows(6, 6, 1);
   
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

    Sheet testSheet  = wb.getSheetAt(0);
    testSheet.shiftRows(3, 3, -1);
        for (Row r : testSheet) {
          r.getRowNum();
        }
    testSheet.shiftRows(6, 6, 1);
   
    //saveReport(wb, new File("/tmp/53798.xlsx"));
    Workbook read = XSSFTestDataSamples.writeOutAndReadBack(wb);
    assertNotNull(read);
   
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

      
       // Test the last Row number it currently correct
       assertEquals(2, sheet.getLastRowNum());
      
       // Shift the first row to the end
       sheet.shiftRows(0, 0, 3);
       assertEquals(3, sheet.getLastRowNum());
       assertEquals(-1,         sheet.getRow(0).getLastCellNum());
       assertEquals("Cell A,2", sheet.getRow(1).getCell(0).getStringCellValue());
       assertEquals("Cell A,3", sheet.getRow(2).getCell(0).getStringCellValue());
       assertEquals("Cell A,1", sheet.getRow(3).getCell(0).getStringCellValue());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

       assertEquals("Cell A,2", sheet.getRow(1).getCell(0).getStringCellValue());
       assertEquals("Cell A,3", sheet.getRow(2).getCell(0).getStringCellValue());
       assertEquals("Cell A,1", sheet.getRow(3).getCell(0).getStringCellValue());
      
       // Shift the 2nd row up to the first one
       sheet.shiftRows(1, 1, -1);
       assertEquals(3, sheet.getLastRowNum());
       assertEquals("Cell A,2", sheet.getRow(0).getCell(0).getStringCellValue());
       assertEquals(-1,         sheet.getRow(1).getLastCellNum());
       assertEquals("Cell A,3", sheet.getRow(2).getCell(0).getStringCellValue());
       assertEquals("Cell A,1", sheet.getRow(3).getCell(0).getStringCellValue());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

       assertEquals(-1,         sheet.getRow(1).getLastCellNum());
       assertEquals("Cell A,3", sheet.getRow(2).getCell(0).getStringCellValue());
       assertEquals("Cell A,1", sheet.getRow(3).getCell(0).getStringCellValue());

       // Shift the 4th row up into the gap in the 3rd row
       sheet.shiftRows(3, 3, -2);
       assertEquals(2, sheet.getLastRowNum());
       assertEquals("Cell A,2", sheet.getRow(0).getCell(0).getStringCellValue());
       assertEquals("Cell A,1", sheet.getRow(1).getCell(0).getStringCellValue());
       assertEquals("Cell A,3", sheet.getRow(2).getCell(0).getStringCellValue());
       assertEquals(-1,         sheet.getRow(3).getLastCellNum());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

      Workbook wb = XSSFTestDataSamples.openSampleWorkbook("48495.xlsx");
     
      assertSheetOrder(wb, "Sheet1");
     
      Sheet sheet = wb.getSheetAt(0);
      sheet.shiftRows(2, sheet.getLastRowNum(), 1, true, false);
      Row newRow = sheet.getRow(2);
      if (newRow == null) newRow = sheet.createRow(2);
      newRow.createCell(0).setCellValue(" Another Header");
      wb.cloneSheet(0);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

      
       // Test the last Row number it currently correct
       assertEquals(2, sheet.getLastRowNum());
      
       // Shift the first row to the end
       sheet.shiftRows(0, 0, 3);
       assertEquals(3, sheet.getLastRowNum());
       assertEquals(-1,         sheet.getRow(0).getLastCellNum());
       assertEquals("Cell A,2", sheet.getRow(1).getCell(0).getStringCellValue());
       assertEquals("Cell A,3", sheet.getRow(2).getCell(0).getStringCellValue());
       assertEquals("Cell A,1", sheet.getRow(3).getCell(0).getStringCellValue());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Sheet.shiftRows()

       assertEquals("Cell A,2", sheet.getRow(1).getCell(0).getStringCellValue());
       assertEquals("Cell A,3", sheet.getRow(2).getCell(0).getStringCellValue());
       assertEquals("Cell A,1", sheet.getRow(3).getCell(0).getStringCellValue());
      
       // Shift the 2nd row up to the first one
       sheet.shiftRows(1, 1, -1);
       assertEquals(3, sheet.getLastRowNum());
       assertEquals("Cell A,2", sheet.getRow(0).getCell(0).getStringCellValue());
       assertEquals(-1,         sheet.getRow(1).getLastCellNum());
       assertEquals("Cell A,3", sheet.getRow(2).getCell(0).getStringCellValue());
       assertEquals("Cell A,1", sheet.getRow(3).getCell(0).getStringCellValue());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.