Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-661

Formula is incorrect after rename Name or it's refersTo region.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.5.0
    • 3.5.0 RC
    • ZSS Range & Model
    • None

      public void testNameModify() {
      		SBook book = SBooks.createBook("book1");
      		book.getBookSeries().setAutoFormulaCacheClean(true);
      		book.createSheet("Sheet0");
      		SSheet sheet1 = book.createSheet("Sheet1");
      		
      		sheet1.getCell("A1").setValue(1);
      		sheet1.getCell("B1").setValue(2);
      		sheet1.getCell("A2").setValue(3);
      		sheet1.getCell("B2").setValue(4);
      		
      		SName name = book.createName("FOO");
      		name.setRefersToFormula("Sheet1!A1:B1");
      		
      		sheet1.getCell("C1").setValue("=SUM(FOO)");
      		
      		Assert.assertEquals(3D, sheet1.getCell("C1").getValue());
      		
      		name.setRefersToFormula("Sheet1!A2:B2");
      		Assert.assertEquals(7D, sheet1.getCell("C1").getValue());//shouldn't fail
      		
      		sheet1.getCell("A2").setValue(5);
      		sheet1.getCell("B2").setValue(6);
      		Assert.assertEquals(11D, sheet1.getCell("C1").getValue());
      		
      		book.setNameName(name, "BAR");
      		Assert.assertEquals("#NAME?", sheet1.getCell("C1").getErrorValue().getErrorString());//shouldn't fail
      		
      		
      		sheet1.getCell("C1").setValue("=SUM(BAR)");
      		Assert.assertEquals(11D, sheet1.getCell("C1").getValue());
      		
      		sheet1.getCell("A2").setValue(7);
      		sheet1.getCell("B2").setValue(8);
      		Assert.assertEquals(15D, sheet1.getCell("C1").getValue());
      	}
      

            henrichen henrichen
            dennis dennis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: