Package org.apache.poi.ss.usermodel

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


 
  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

    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

        Comment comment = sheet.getCellComment(0, 0);
        assertNotNull(comment);
        assertEquals("Amdocs", comment.getAuthor());
        assertEquals("Amdocs:\ntest\n", comment.getString().getString());
       
        sheet.shiftRows(0, 1, 1);

        // comment in row 0 is gone
        comment = sheet.getCellComment(0, 0);
        assertNull(comment);
       
View Full Code Here

        this.cells.putAll(cells);
    }

    public void insertAt(Workbook workbook, SheetIndex sheetIndex, RowIndex rowIndex) {
        Sheet sheet = workbook.getSheetAt(sheetIndex.value());
        sheet.shiftRows(rowIndex.value(), sheet.getLastRowNum(), shiftDownAmount);
        org.apache.poi.ss.usermodel.Row row = sheet.createRow(rowIndex.value());
        copyCellsTo(row, workbook);
    }

    public void appendTo(Workbook workbook, SheetIndex index) {
View Full Code Here

      int rowNum = row.getRowNum();
      int itemCount = modelList.size();
      int rowCount = itemCount * interval;
     
      //shifts the rows after this (less the existing one)
      sheet.shiftRows(rowNum, sheet.getLastRowNum(), rowCount - interval, true, false);
     
      //for each interval
      for (int i = 0; i < itemCount; i++) {
       
        Object item = modelList.get(i);
View Full Code Here

        Row row5 = sheet.createRow(9);
        row5.createCell(4).setCellValue(5);

        // Shift rows 6 - 11 on the spreadsheet to the top (rows 0 - 5)
        sheet.shiftRows(5, 10, -4);

        FileOutputStream fileOut = new FileOutputStream("shiftRows.xlsx");
        wb.write(fileOut);
        fileOut.close();
View Full Code Here

    }

    private void bug53798Work(Workbook wb, File xlsOutput) throws IOException {
        Sheet testSheet = wb.getSheetAt(0);

        testSheet.shiftRows(2, 2, 1);

        saveAndReloadReport(wb, xlsOutput);

        // 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)
View Full Code Here

        saveAndReloadReport(wb, xlsOutput);

        // 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, -1);

        saveAndReloadReport(wb, xlsOutput);

        testSheet.shiftRows(2, 2, 1);
View Full Code Here

        // when shifted by less than -1 negative amount (try -2)
        testSheet.shiftRows(3, 3, -1);

        saveAndReloadReport(wb, xlsOutput);

        testSheet.shiftRows(2, 2, 1);

        saveAndReloadReport(wb, xlsOutput);

        Row newRow = null;
        Cell newCell = null;
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.