Package org.apache.poi.hssf.usermodel

Examples of org.apache.poi.hssf.usermodel.HSSFWorkbook.createSheet()


  public void testParseAreaRefHighRow_bug45358() {
    Ptg[] ptgs;
    AreaI aptg;

    HSSFWorkbook book = new HSSFWorkbook();
    book.createSheet("Sheet1");

    ptgs = HSSFFormulaParser.parse("Sheet1!A10:A40000", book);
    aptg = (AreaI) ptgs[0];
    if (aptg.getLastRow() == -25537) {
      throw new AssertionFailedError("Identified bug 45358");
View Full Code Here


  }

  public void testRangeOperator() {

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet();
    HSSFCell cell = sheet.createRow(0).createCell(0);

    wb.setSheetName(0, "Sheet1");
    cell.setCellFormula("Sheet1!B$4:Sheet1!$C1"); // explicit range ':' operator
    assertEquals("Sheet1!B$4:Sheet1!$C1", cell.getCellFormula());
View Full Code Here

  }

  public void testBooleanNamedSheet() {

    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("true");
    HSSFCell cell = sheet.createRow(0).createCell(0);
    cell.setCellFormula("'true'!B2");

    assertEquals("'true'!B2", cell.getCellFormula());
  }
View Full Code Here

  }

  public void testUnion() {
    String formula = "Sheet1!$B$2:$C$3,OFFSET(Sheet1!$E$2:$E$4,1,Sheet1!$A$1),Sheet1!$D$6";
    HSSFWorkbook wb = new HSSFWorkbook();
    wb.createSheet("Sheet1");
    Ptg[] ptgs = FormulaParser.parse(formula, HSSFEvaluationWorkbook.create(wb), FormulaType.CELL, -1);

    confirmTokenClasses(ptgs,
        // TODO - AttrPtg.class, // Excel prepends this
        MemFuncPtg.class,
View Full Code Here

  }

  public void testRange_bug46643() {
    String formula = "Sheet1!A1:Sheet1!B3";
    HSSFWorkbook wb = new HSSFWorkbook();
    wb.createSheet("Sheet1");
    Ptg[] ptgs = FormulaParser.parse(formula, HSSFEvaluationWorkbook.create(wb), FormulaType.CELL, -1);

    if (ptgs.length == 3) {
      confirmTokenClasses(ptgs, Ref3DPtg.class, Ref3DPtg.class, RangePtg.class);
      throw new AssertionFailedError("Identified bug 46643");
View Full Code Here

    HSSFName name = wb.createName();
    name.setNameName("POI\\2009");
    name.setRefersToFormula("Sheet1!$A$1");

    HSSFSheet sheet = wb.createSheet();
    HSSFRow row = sheet.createRow(0);

    HSSFCell cell_C1 =  row.createCell(2);
    cell_C1.setCellFormula("POI\\2009");
    assertEquals("POI\\2009", cell_C1.getCellFormula());
View Full Code Here

   * TODO - delete equiv test:
   * {@link BaseTestBugzillaIssues#test42448()}
   */
  public void testParseAbnormalSheetNamesAndRanges_bug42448() {
    HSSFWorkbook wb = new HSSFWorkbook();
    wb.createSheet("A");
    try {
      HSSFFormulaParser.parse("SUM(A!C7:A!C67)", wb);
    } catch (StringIndexOutOfBoundsException e) {
      throw new AssertionFailedError("Identified bug 42448");
    }
View Full Code Here

        AreaPtg.class,
        UnionPtg.class
    );

    HSSFWorkbook wb = new HSSFWorkbook();
    wb.createSheet("Sheet1");
    ptgs = HSSFFormulaParser.parse("Sheet1!$A:$A,Sheet1!$1:$4", wb);
    confirmTokenClasses(ptgs, MemFuncPtg.class,
        Area3DPtg.class,
        Area3DPtg.class,
        UnionPtg.class
View Full Code Here

  }


  public void testExplicitRangeWithTwoSheetNames() {
    HSSFWorkbook wb = new HSSFWorkbook();
    wb.createSheet("Sheet1");
    Ptg[] ptgs = HSSFFormulaParser.parse("Sheet1!F1:Sheet1!G2", wb);
    confirmTokenClasses(ptgs,
        MemFuncPtg.class,
        Ref3DPtg.class,
        Ref3DPtg.class,
View Full Code Here

   * Mostly confirming that erroneous conditions are detected.  Actual error message wording is not critical.
   *
   */
  public void testEdgeCaseParserErrors() {
    HSSFWorkbook wb = new HSSFWorkbook();
    wb.createSheet("Sheet1");

    confirmParseError(wb, "A1:ROUND(B1,1)", "The RHS of the range operator ':' at position 3 is not a proper reference.");

    confirmParseError(wb, "Sheet1!Sheet1", "Cell reference expected after sheet name at index 8.");
    confirmParseError(wb, "Sheet1!F:Sheet1!G", "'Sheet1!F' is not a proper reference.");
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.