Hi All,

Please provide solution for my problem.

From: Pratik Thaker
Sent: Friday, April 17, 2015 8:15 PM
To: '[email protected]'
Subject: Typable dropdown in excel file (XLSX)

Hi,

Is there a way to create typable dropdown in the excel file (XLSX) using POI, 
where values in the list will get filtered as user types ?

I am using below code to show the dropdown,

public class sd {

/**
* @param args
* @throws IOException
 */
public static void main(String[] args) throws IOException {

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(0,5,0,0);
    constraint =validationHelper.createExplicitListConstraint(new 
String[]{"SELECT","10", "20", "30"});
    dataValidation = validationHelper.createValidation(constraint, addressList);
    dataValidation.setSuppressDropDownArrow(true);
    sheet1.addValidationData(dataValidation);

    FileOutputStream fileOut = new FileOutputStream("c:\\temp\\vineet.xlsx");
    wb.write(fileOut);
    fileOut.close();
}

}

Thanks.
________________________________
The information in this email is confidential and may be legally privileged. It 
is intended solely for the addressee. Access to this email by anyone else is 
unauthorised. If you are not the intended recipient, any disclosure, copying, 
distribution or any action taken or omitted to be taken in reliance on it, is 
prohibited and may be unlawful.

Reply via email to