@@ -143,13 +143,14 @@ protected boolean putContentInCell(E currentobject, Cell cell, String context) {
143143 + " would be of type ChoiceDataObjectField but in reality, it is " + field .getClass ().toString ());
144144 ChoiceDataObjectField <F , E > choicefield = (ChoiceDataObjectField <F , E >) field ;
145145 cell .setCellValue ((choicefield .getValue () == null ? "" : choicefield .getValue ().getDisplayValue ()));
146- ChoiceDataObjectFieldFlatFileLoaderColumn .setRestrictionsOnCell (cell ,fieldchoicedefinition );
146+ // ChoiceDataObjectFieldFlatFileLoaderColumn.setRestrictionsOnCell(cell,fieldchoicedefinition);
147147 return false ;
148148 }
149149
150150 /**
151151 * sets restriction on cell so that only display values in the list of value, or
152- * empty string, can be entered
152+ * empty string, can be entered. Warning: in current version, does not work in
153+ * excel (works with Libre Office though)
153154 *
154155 * @param cell cell
155156 * @param choicedefinition choice definition
@@ -158,11 +159,14 @@ public static <E extends FieldChoiceDefinition<E>> void setRestrictionsOnCell(Ce
158159 ArrayList <String > restrictions = new ArrayList <String >();
159160 restrictions .add ("" );
160161 ChoiceValue <E >[] choices = choicedefinition .getChoiceValue ();
161- for (int i =0 ;i <choices .length ;i ++) restrictions .add (choices [i ].getDisplayValue ());
162+ for (int i = 0 ; i < choices .length ; i ++)
163+ restrictions .add (choices [i ].getDisplayValue ());
162164 XSSFSheet sheet = (XSSFSheet ) cell .getSheet ();
163165 DataValidationHelper validationHelper = new XSSFDataValidationHelper (sheet );
164- DataValidationConstraint constraint = validationHelper .createExplicitListConstraint (restrictions .toArray (new String [0 ]));
165- CellRangeAddressList addressList = new CellRangeAddressList (cell .getRowIndex (),cell .getRowIndex (), cell .getColumnIndex (),cell .getColumnIndex ());
166+ DataValidationConstraint constraint = validationHelper
167+ .createExplicitListConstraint (restrictions .toArray (new String [0 ]));
168+ CellRangeAddressList addressList = new CellRangeAddressList (cell .getRowIndex (), cell .getRowIndex (),
169+ cell .getColumnIndex (), cell .getColumnIndex ());
166170 DataValidation dataValidation = validationHelper .createValidation (constraint , addressList );
167171 dataValidation .setErrorStyle (DataValidation .ErrorStyle .STOP );
168172 dataValidation .setSuppressDropDownArrow (true );
0 commit comments