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

Same name for range in sheet and workbook scope not found in FormulaTunerHelper, cause failed updates

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.9.2
    • 3.9.1
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      Run ZSS with the attached test.xlsx
      on Sheet1, C10:H10 is a named range, scope workbook, named "test.xlsx TestName"
      on Sheet2, C10:H10 is a local named range, scope Sheet, named "test.xlsx Sheet 2!Testname"

      The value of the cells in these ranges can be tested with formulas:
      =SUM('Sheet 2'!TestName)
      =SUM('Sheet1'!TestName)

      enter different values in both ranges.
      copy formulas in sheet 1 and in sheet2
      Both will return the expected values (sum of all cells in range)

      On Sheet 1:
      Right click on line 9, choose insert
      A new line is added
      delete the current result cells and copy the formulas

      repeat on sheet 2

      Current Result

      Sheet1 workbook level range still refer to the same cells (before C10:H10, after C11:H11)
      Sheet2 sheet level range was not updated (before C10:H10, after C10:H10)

      Expected Result

      Sheet2 sheet level range should have been updated (before C10:H10, after C11:H11)

      Debug Info

      Caused by missing Range name returned by org.zkoss.zss.model.impl.FormulaTunerHelper.extendNameRef(SheetRegion, NameRef, boolean) line 849

      book.getNameByName(dependent.getNameName()) 
      

      is a shorthand for:

      org.zkoss.zss.model.impl.BookImpl.getNameByName(String, null)
      

      where the null value should be the sheet prefix in the name ranged declaration. Since the sheet prefix is not used, if a book level name range and a sheet level name range exist with the same name, the sheet level range will always be ignored.

      Root Cause

      Workaround

      Use attached FormulaTunerHelper.java to replace default implementation.
      Add the java class to classpath while maintaining its package structure.

            henrichen henrichen
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: