excel - Java Apache POI HSSF CellRangeAddressList -
i trying set app users download excel spreadsheet insert data , want 1 of cells in sheet have data validation drop down list.
i following guidance on apache poi site (https://poi.apache.org/spreadsheet/quick-guide.html#validation) includes guidance utilize cellrangeaddresslist data type , constructor.
here full code using apache site:
hssfworkbook workbook = new hssfworkbook(); hssfsheet sheet = workbook.createsheet("data validation"); cellrangeaddresslist addresslist = new cellrangeaddresslist( 0, 0, 0, 0); dvconstraint dvconstraint = dvconstraint.createexplicitlistconstraint( new string[]{"10", "20", "30"}); datavalidation datavalidation = new hssfdatavalidation (addresslist, dvconstraint); datavalidation.setsuppressdropdownarrow(false); sheet.addvalidationdata(datavalidation);
however, when use in code, netbeans giving me deprecated api error. there more recent and/or appropriate datatype should using.
which package have imported class cellrangeaddresslist
might using package :
import org.apache.poi.hssf.util.cellrangeaddresslist;
try below package same class :
import org.apache.poi.ss.util.cellrangeaddresslist;
Comments
Post a Comment