Package org.apache.poi.ss.usermodel

Examples of org.apache.poi.ss.usermodel.Workbook.createSheet()


      );
  }

    public void testSimpleArithmatic() throws Exception {
      Workbook wb = new XSSFWorkbook();
      Sheet s = wb.createSheet();
      Row r = s.createRow(0);
     
      Cell c1 = r.createCell(0);
      c1.setCellFormula("1+5");
      assertTrue( Double.isNaN(c1.getNumericCellValue()) );
View Full Code Here


      assertEquals(5.0, c2.getNumericCellValue(), 0.0001);
    }
   
    public void testSumCount() throws Exception {
      Workbook wb = new XSSFWorkbook();
      Sheet s = wb.createSheet();
      Row r = s.createRow(0);
      r.createCell(0).setCellValue(2.5);
      r.createCell(1).setCellValue(1.1);
      r.createCell(2).setCellValue(3.2);
      r.createCell(4).setCellValue(10.7);
View Full Code Here

    };
   
    for (int i = 0; i < wbs.length; i++) {
      Workbook wb = wbs[i];
        CreationHelper createHelper = wb.getCreationHelper();
        Sheet sheet = wb.createSheet("new sheet");

        // Create a row and put some cells in it. Rows are 0 based.
        Row row = sheet.createRow((short)0);
        // Create a cell and put a value in it.
        Cell cell = row.createCell((short)0);
View Full Code Here

 
  public static void newDateCells() throws IOException {
      Workbook wb = new HSSFWorkbook();
      //Workbook wb = new XSSFWorkbook();
      CreationHelper createHelper = wb.getCreationHelper();
      Sheet sheet = wb.createSheet("new sheet");

      // Create a row and put some cells in it. Rows are 0 based.
      Row row = sheet.createRow((short)0);
   
      // Create a cell and put a date value in it.  The first cell is not styled
View Full Code Here

      fileOut.close();
  }
 
  public static void iterating() {
      Workbook wb = new HSSFWorkbook();
      Sheet sheet = wb.createSheet("new sheet");
     
      for (Row row : sheet) {
          for (Cell cell : row) {
              // Do something here
            System.out.println(cell.getCellType());
View Full Code Here

    /**
     * Tests that cell formatting stuff works as expected
     */
    public void testCellFormatting() throws Exception {
      Workbook workbook = new XSSFWorkbook();
      Sheet sheet = workbook.createSheet();
      CreationHelper creationHelper = workbook.getCreationHelper();
     
      CellStyle cs = workbook.createCellStyle();
      assertNotNull(cs);
     
View Full Code Here

        final Workbook wb = new XSSFWorkbook();
        final String sheetName =  cls.getSimpleName();
        final File tempFile = File.createTempFile(ExcelConverter.class.getName(), sheetName + XLSX_SUFFIX);

        final FileOutputStream fos = new FileOutputStream(tempFile);
        final Sheet sheet = wb.createSheet(sheetName);
       
        final ExcelConverter.RowFactory rowFactory = new RowFactory(sheet);
        final Row headerRow = rowFactory.newRow();
       
        // header row
View Full Code Here

   * Functions like IF, INDIRECT, INDEX, OFFSET etc can return AreaEvals which
   * should be dereferenced by the evaluator
   */
  public void testResultOutsideRange() {
    Workbook wb = new HSSFWorkbook();
    Cell cell = wb.createSheet("Sheet1").createRow(0).createCell(0);
    cell.setCellFormula("D2:D5"); // IF(TRUE,D2:D5,D2) or  OFFSET(D2:D5,0,0) would work too
    FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
    CellValue cv;
    try {
      cv = fe.evaluate(cell);
View Full Code Here

          if(args.length < 2){
            System.err.println("Usage: AddDimensionedImage imageFile outputFile");
            return;
          }
          workbook = new HSSFWorkbook();
          sheet = workbook.createSheet("Picture Test");
            // Note that as the code has been ported to the SS model, the following
            // would be equally as valid - workbook = new XSSFWorkbook();
          imageFile = args[0];
          outputFile = args[1];
          new AddDimensionedImage().addImageToSheet("B5", sheet, sheet.createDrawingPatriarch(),
View Full Code Here

   * Functions like IF, INDIRECT, INDEX, OFFSET etc can return AreaEvals which
   * should be dereferenced by the evaluator
   */
  public void testResultOutsideRange() {
    Workbook wb = new HSSFWorkbook();
    Cell cell = wb.createSheet("Sheet1").createRow(0).createCell(0);
    cell.setCellFormula("D2:D5"); // IF(TRUE,D2:D5,D2) or  OFFSET(D2:D5,0,0) would work too
    FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
    CellValue cv;
    try {
      cv = fe.evaluate(cell);
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.