Examples of shiftRows()


Examples of org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows()

        assertEquals( s.getRow( 3 ).getPhysicalNumberOfCells(), 4 );
        assertEquals( s.getRow( 4 ).getPhysicalNumberOfCells(), 5 );

        // Shift rows 1-3 down 3 in the current one.  This tests when
        // 1 row is blank.  Write to a another temp file
        s.shiftRows( 0, 2, 3 );
        tempFile = TempFile.createTempFile( "shift", "test.xls" );
        fout = new FileOutputStream( tempFile );
        wb.write( fout );
        fout.close();
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows()

        wb = new HSSFWorkbook( fin );
        fin.close();
        s = wb.getSheetAt( 0 );

        // Shift rows 3 and 4 up and write to temp file
        s.shiftRows( 2, 3, -2 );
        tempFile = TempFile.createTempFile( "shift", "test.xls" );
        fout = new FileOutputStream( tempFile );
        wb.write( fout );
        fout.close();
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows()

    public void testShiftRow(){
     HSSFWorkbook b = new HSSFWorkbook();
     HSSFSheet s    = b.createSheet();
     s.createRow(0).createCell((short)0).setCellValue("TEST1");
     s.createRow(3).createCell((short)0).setCellValue("TEST2");
     s.shiftRows(0,4,1);
    }

    /**
     * Tests when shifting the first row.
     *
 
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows()

    public void testShiftRow0(){
     HSSFWorkbook b = new HSSFWorkbook();
     HSSFSheet s    = b.createSheet();
     s.createRow(0).createCell((short)0).setCellValue("TEST1");
     s.createRow(3).createCell((short)0).setCellValue("TEST2");
     s.shiftRows(0,4,1);
    }
   
    /**
     * When shifting rows, the page breaks should go with it
     *
 
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows()

      HSSFSheet s    = b.createSheet();
      HSSFRow row = s.createRow(4);
      row.createCell((short)0).setCellValue("test");
      s.setRowBreak(4);
     
      s.shiftRows(4, 4, 2);
      assertTrue("Row number 6 should have a pagebreak", s.isRowBroken(6));
     
    }
}
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows()

        HSSFWorkbook wb = new HSSFWorkbook( fin );
        fin.close();
        HSSFSheet s = wb.getSheetAt( 0 );

        // Shift the second row down 1 and write to temp file
        s.shiftRows( 1, 1, 1 );
        File tempFile = TempFile.createTempFile( "shift", "test.xls" );
        FileOutputStream fout = new FileOutputStream( tempFile );
        wb.write( fout );
        fout.close();
View Full Code Here

Examples of org.apache.poi.hssf.usermodel.HSSFSheet.shiftRows()

        assertEquals( s.getRow( 3 ).getPhysicalNumberOfCells(), 4 );
        assertEquals( s.getRow( 4 ).getPhysicalNumberOfCells(), 5 );

        // Shift rows 1-3 down 3 in the current one.  This tests when
        // 1 row is blank.  Write to a another temp file
        s.shiftRows( 0, 2, 3 );
        tempFile = TempFile.createTempFile( "shift", "test.xls" );
        fout = new FileOutputStream( tempFile );
        wb.write( fout );
        fout.close();
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
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.