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

Should validate name of the created Name

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 3.5.0
    • Fix Version/s: 3.5.0
    • Component/s: ZSS Range & Model
    • Labels:
      None

      Description

      When Range.createName(String nameName), we should validate the nameName first.

        Activity

        Hide
        henrichen henrichen added a comment - - edited

        See http://office.microsoft.com/en-us/excel-help/define-and-use-names-in-formulas-HA010147120.aspx

        Syntax of naming a Name:

        1. First character must be a letter, an underscore("_"), or a backslash("\")
        2. Remaining characters can be letters, numbers, periods("."), and underscore("_")
        3. letters are as defined in Unitcode; i.e. "中" is legal letter and "文" is legal letter.
        4. Valid cell reference CANNOT be name of a Name.
        5. space is not allowed in name.
        6. length of the name cannot exceed 255.
        7. Case insensitive. "myname" == "MYNAME"
        8. Must be unique in the scope(book or sheet)
        9. Cannot be 'R', 'r', 'C', 'c'

        Scope of the name:
        1. Can be defined in a book or in a sheet
        2. All sheets in a book can USE the name defined in that book.
        3. Only the sheet can USE the name defined in that sheet.
        4. If USE a name that is both defined in a book and in a sheet(which belongs to the book); the one defined in the sheet will take precedence.
        5. By explicitly specify book name(e.g. Book1!myname) to override the precedence as specified in case 4.

        Show
        henrichen henrichen added a comment - - edited See http://office.microsoft.com/en-us/excel-help/define-and-use-names-in-formulas-HA010147120.aspx Syntax of naming a Name: 1. First character must be a letter, an underscore("_"), or a backslash("\") 2. Remaining characters can be letters, numbers, periods("."), and underscore("_") 3. letters are as defined in Unitcode; i.e. "中" is legal letter and "文" is legal letter. 4. Valid cell reference CANNOT be name of a Name. 5. space is not allowed in name. 6. length of the name cannot exceed 255. 7. Case insensitive. "myname" == "MYNAME" 8. Must be unique in the scope(book or sheet) 9. Cannot be 'R', 'r', 'C', 'c' Scope of the name: 1. Can be defined in a book or in a sheet 2. All sheets in a book can USE the name defined in that book. 3. Only the sheet can USE the name defined in that sheet. 4. If USE a name that is both defined in a book and in a sheet(which belongs to the book); the one defined in the sheet will take precedence. 5. By explicitly specify book name(e.g. Book1!myname) to override the precedence as specified in case 4.
        Hide
        henrichen henrichen added a comment -

        Implement in checkLegalNameName() of zssmodel/src/org/zkoss/zss/model/impl/BookImpl.java

        https://github.com/zkoss/zkspreadsheet/commit/c990ee8b4a764c3d2e28e8fb6caf84af54392f6c

        Show
        henrichen henrichen added a comment - Implement in checkLegalNameName() of zssmodel/src/org/zkoss/zss/model/impl/BookImpl.java https://github.com/zkoss/zkspreadsheet/commit/c990ee8b4a764c3d2e28e8fb6caf84af54392f6c
        Hide
        hawk hawk added a comment -
        Show
        hawk hawk added a comment - add JUnit test case to check valid and invalid name. https://github.com/zkoss/zkspreadsheet/commit/73404fc5cd59d60f4fd4c3e708031e37413eaa81
        Hide
        henrichen henrichen added a comment -

        Fixed.

        Show
        henrichen henrichen added a comment - Fixed.

          People

          • Assignee:
            henrichen henrichen
            Reporter:
            henrichen henrichen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: