Unable display comma value in cell content using d

2019-08-27 14:15发布

问题:

I am using Apache POI (v 3.8) for adding drop down list for cell with data validation.But comma(,) value is separated to another value in list.Other than comma (,) its working fine and check below screen shot

Code

DataValidation dataValidation = null;
DataValidationConstraint constraint = null;
DataValidationHelper validationHelper = null;
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet1=(XSSFSheet) wb.createSheet("sheet1");

validationHelper=new XSSFDataValidationHelper(sheet1);
CellRangeAddressList addressList = new  CellRangeAddressList(1,10,1,1);
constraint =validationHelper.createExplicitListConstraint(new String[]{"SELECT","A,B", "C%D","B$D", "C&D","A( A & B)"});
dataValidation = validationHelper.createValidation(constraint, addressList);
dataValidation.setSuppressDropDownArrow(true);      
sheet1.addValidationData(dataValidation);
FileOutputStream fileOut;
        try {
            fileOut = new FileOutputStream("f:\\test-1.xlsx");
              wb.write(fileOut);
                fileOut.close();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

I tried to replace with ASCII code.But appended ascii code value instead of comma(,).Please help on this