The code is as follows: private void addDataField(DataConsolidateFunction function, int columnIndex, String valueFieldName, String valueFormat) { ... dataField.setSubtotal(STDataConsolidateFunction.Enum.forInt(function.getValue())); } I noticed that an early version of NPOI is quite similar: private void AddDataField(DataConsolidateFunction function, int columnIndex, Str... dataField.subtotal = (ST_DataConsolidateFunction)(function.Value); } However, it is revised to: private void AddDataField(DataConsolidateFunction function, int columnIndex, Str... dataField.subtotal = (ST_DataConsolidateFunction)(function.Value-1); } The commit is as follows: https://github.com/nissl-lab/npoi/commit/1e1e7f07dc04ca17a96819e015df6dcded37b399
Please provide a real world example that proves the code is incorrect. We are not going to just copy what NPOI do. That NPOI commit has no tests to verify the change.
No update for some time, thus closing this for now as we likely won't fix anything until it is clear that this is a real problem. Furthermore when looking at STDataConsolidateFunction.Enum and DataConsolidateFunction, I think the indices of the two enums are equal, so it would even introduce a bug if we would apply this change. Not sure if things are different for NPOI, but you might check if the change is even useful there or actually introduced a bug.