Package org.apache.poi.ss.usermodel

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


    public void testApplyCellForDateFormatWithConditions() {
       
        // Create a workbook, row and cell to test with
        Workbook wb = new HSSFWorkbook();
        Sheet sheet = wb.createSheet();
        Row row = sheet.createRow(0);
        Cell cell = row.createCell(0);
       
        CellFormat cf = CellFormat.getInstance("[<1]hh:mm:ss AM/PM;[>=1]dd/mm/yyyy hh:mm:ss AM/PM;General");
       
        cell.setCellValue(0.5);
View Full Code Here


    public void testSimpleFractionFormat() {
        CellFormat cf1 = CellFormat.getInstance("# ?/?");
        // Create a workbook, row and cell to test with
        Workbook wb = new HSSFWorkbook();
        Sheet sheet = wb.createSheet();
        Row row = sheet.createRow(0);
        Cell cell = row.createCell(0);
        cell.setCellValue(123456.6);
        System.out.println(cf1.apply(cell).text);
        assertEquals("123456 3/5", cf1.apply(cell).text);
    }
View Full Code Here

    public void testAddToExistingWorkbook() {
      XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
      xssfWorkbook.createSheet("S1");
      Sheet sheet = xssfWorkbook.createSheet("S2");
      Row row = sheet.createRow(1);
      Cell cell = row.createCell(1);
      cell.setCellValue("value 2_1_1");
      SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
      xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
        wb.dispose();
View Full Code Here

        wb = new SXSSFWorkbook(xssfWorkbook);

      // Add a row to the existing empty sheet
      Sheet sheet1 = wb.getSheetAt(0);
      Row row1_1 = sheet1.createRow(1);
      Cell cell1_1_1 = row1_1.createCell(1);
      cell1_1_1.setCellValue("value 1_1_1");

      // Add a row to the existing non-empty sheet
      Sheet sheet2 = wb.getSheetAt(1);
View Full Code Here

      Cell cell1_1_1 = row1_1.createCell(1);
      cell1_1_1.setCellValue("value 1_1_1");

      // Add a row to the existing non-empty sheet
      Sheet sheet2 = wb.getSheetAt(1);
      Row row2_2 = sheet2.createRow(2);
      Cell cell2_2_1 = row2_2.createCell(1);
      cell2_2_1.setCellValue("value 2_2_1");

      // Add a sheet with one row
      Sheet sheet3 = wb.createSheet("S3");
View Full Code Here

      Cell cell2_2_1 = row2_2.createCell(1);
      cell2_2_1.setCellValue("value 2_2_1");

      // Add a sheet with one row
      Sheet sheet3 = wb.createSheet("S3");
      Row row3_1 = sheet3.createRow(1);
      Cell cell3_1_1 = row3_1.createCell(1);
      cell3_1_1.setCellValue("value 3_1_1");

      xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
      assertEquals(3, xssfWorkbook.getNumberOfSheets());
View Full Code Here

        int rowNum = 1000;
        int sheetNum = 5;
        for(int i = 0; i < sheetNum; i++){
            Sheet sh = wb.createSheet("sheet" + i);
            for(int j = 0; j < rowNum; j++){
                Row row = sh.createRow(j);
                Cell cell1 = row.createCell(0);
                cell1.setCellValue(new CellReference(cell1).formatAsString());

                Cell cell2 = row.createCell(1);
                cell2.setCellValue(i);
View Full Code Here

        int rowNum = 1000;
        int sheetNum = 5;
        for(int i = 0; i < sheetNum; i++){
            Sheet sh = wb.createSheet("sheet" + i);
            for(int j = 0; j < rowNum; j++){
                Row row = sh.createRow(j);
                Cell cell1 = row.createCell(0);
                cell1.setCellValue(new CellReference(cell1).formatAsString());

                Cell cell2 = row.createCell(1);
                cell2.setCellValue(i);
View Full Code Here

  }

  private static void populateWorkbook(Workbook wb) {
    Sheet sh = wb.createSheet();
    for (int rownum = 0; rownum < 100; rownum++) {
      Row row = sh.createRow(rownum);
      for (int cellnum = 0; cellnum < 10; cellnum++) {
        Cell cell = row.createCell(cellnum);
        String address = new CellReference(cell).formatAsString();
        cell.setCellValue(address);
      }
View Full Code Here

    @Test
    public void bug50416LastRowNumber() {
       // Create the workbook with 1 sheet which contains 3 rows
       HSSFWorkbook workbook = new HSSFWorkbook();
       Sheet sheet = workbook.createSheet("Bug50416");
       Row row1 = sheet.createRow(0);
       Cell cellA_1 = row1.createCell(0,Cell.CELL_TYPE_STRING);
       cellA_1.setCellValue("Cell A,1");
       Row row2 = sheet.createRow(1);
       Cell cellA_2 = row2.createCell(0,Cell.CELL_TYPE_STRING);
       cellA_2.setCellValue("Cell A,2");
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.