https://bz.apache.org/bugzilla/show_bug.cgi?id=59719

            Bug ID: 59719
           Summary: XSSFDataValidationConstraint doesn't parse static list
                    text properly
           Product: POI
           Version: 3.15-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 33959
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33959&action=edit
patch to properly parse static list validation constraints

When you add a LIST type validation to a cell in Excel, and type a comma
separated list of values to accept instead of using a range reference or named
range, the value is stored in the XLSX sheet XML as a "formula1" string:

"one, two, three"

named ranges as list validation values are stored in formula1 as

range_name

note the lack of double quotes.

Currently, XSSFDataValidationConstraint just splits all "formula1" strings by
comma.  This makes the first and last values include the double quotes, and all
values contain any whitespace leading or trailing a comma.

Excel automatically trims whitespace when parsing the CSV value strings.

The attached patch checks for and removes the enclosing quotes, and uses a
compiled pattern to split by commas with optional whitespace.

If the formula isn't enclosed in double quotes, it is not parsed into the
explicit values array.

I can't tell from inspecting XLSX files how Excel knows whether a formula is a
list of values or a range, other than the quotes, or falling back on a list if
evaluating as a range fails.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to