Exemple #1
0
  public void testFormulaGeneral() throws IOException {
    // perhaps this testcase belongs on TestHSSFName
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFName name = wb.createName();
    wb.createSheet("Sheet1");
    name.setNameName("test");
    name.setRefersToFormula("Sheet1!A1+Sheet1!A2");
    assertEquals("Sheet1!A1+Sheet1!A2", name.getRefersToFormula());
    name.setRefersToFormula("5*6");
    assertEquals("5*6", name.getRefersToFormula());

    wb.close();
  }
Exemple #2
0
 public void testFormulaRelAbs_bug46174() throws IOException {
   // perhaps this testcase belongs on TestHSSFName
   HSSFWorkbook wb = new HSSFWorkbook();
   HSSFName name = wb.createName();
   wb.createSheet("Sheet1");
   name.setNameName("test");
   name.setRefersToFormula("Sheet1!$B$3");
   if (name.getRefersToFormula().equals("Sheet1!B3")) {
     fail("Identified bug 46174");
   }
   assertEquals("Sheet1!$B$3", name.getRefersToFormula());
   wb.close();
 }