Bug 55713 - DataValidation, getErrorStyle(), getEmptyCellAllowed() flags are wrong
Summary: DataValidation, getErrorStyle(), getEmptyCellAllowed() flags are wrong
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.0.x-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
: 60870 (view as bug list)
Depends on:
Reported: 2013-10-28 13:56 UTC by Eli Vingot
Modified: 2018-12-22 19:13 UTC (History)
1 user (show)

Code and Example XLSX (6.60 KB, application/x-zip-compressed)
2018-01-25 13:55 UTC, Phili0815

Note You need to log in before you can comment on or make changes to this bug.
Description Eli Vingot 2013-10-28 13:56:46 UTC
When reading XLSX files with data validations.
DataValidation.getErrorStyle() always returns 1 (warning)
DataValidation.getEmptyCellAllowed() always returns true.

Checked in 3.7 and 3.9 for XSSFSheet.
Comment 1 Nick Burch 2013-11-07 22:51:41 UTC
Any chance you could produce a short unit test that shows the problem? For example, a small file with a few different validations in it, some valid and some not, along with a short bit of POI code that tries to read and assert them?
Comment 2 Dominik Stadler 2015-09-13 18:39:37 UTC
No response for a long time, therefore closing this as WONTFIX as we do not have a file/unit test which reproduces the issue.
Please reopen this bug with more information if you still see this problem with a more recent version of POI.
Comment 3 Phili0815 2018-01-25 13:55:44 UTC
Created attachment 35696 [details]
Code and Example XLSX
Comment 4 Phili0815 2018-01-25 14:04:51 UTC
I can confirm the problem with the errorStyle.

I you have a data validation with errorStyle = STOP, then DataValidation.getErrorStyle() will return WARNING. I added an example and junit test showing the problem.

I looked into the .xslx file internals and noticed that Excel does not save the errorStyle attribute in the XML schema if the errorStyle equals STOP. So it seems that the default value for errorStyle is wrong.

DataValidation.getEmptyCellAllowed() seems to work fine for me. I think the problem is the name which is quite missleading compared to the Excel UI.
At least in the German Excel the attribute "emptyCellAllowed = true" equals to the option "ignore empty cells". 

I think this is because the Excel UI wants to tell me something like "we won't check empty cells" but the implementation defines it like "empty cells are always valid".
Comment 6 Dominik Stadler 2018-12-22 19:13:09 UTC
*** Bug 60870 has been marked as a duplicate of this bug. ***