Description
The mandatoryCell
feature works rather strangely:
- does detect missing cells for XLS files
- does not detect missing cells for XLSX files
- does not detect blank cells (i.e. without data but with changed format) for XLSX sheets (i.e. when already opened as a
XSSFSheet
instance) - does detect missing cells for XLSX sheets
- does not detect blank cells for XLS files
The first three cases are documented, i.e. I shouldn't expect the parser to work correctly for XLSX format, however the last two aren't.
From layman's point of view there isn't too much difference between blank and missing cells, meaning nobody will re-examine if the contents of the cell were cleared together with or without formatting. Thus, it makes sense to expect the same com.poiji.exception.PoijiMultiRowException
for both blank and missing cells in an XLS workbook that the feature applies to.
Seeing that XSSFSheet
is actually parsed the same way as HSSFSheet
using com.poiji.bind.mapping.SheetUnmarshaller
we can at least try to fix/improve behavior for opened sheets. XLSX files and streams use a different unmarshaller and mandatoryCell
check isn't done there in any way, i.e. adding this feature there may be out of scope for this issue.
I've added test cases to my missing-cell-ignored branch. The excel files basically have the same input as the constructed sheet in com.poiji.deserialize.MandatoryCellsExceptionTest#createDummyExcel
. The old XLS format was derived from the XLSX using the ssconvert
utility.