问题描述
请问,使用jXL写Excel文件时,如何通过程序生成下拉框。就是在excel中点击此列的单元格,然后显示一个下拉框,有些值可选。欢迎大侠指点,谢谢!!!我在本地用excel2007,WritableCellFeatureswcfc=newWritableCellFeatures();List<String>al=newArrayList<String>();al.add("TheFellowshipoftheRing");al.add("TheTwoTowers");al.add("TheReturnoftheKing");wcfc.setDataValidationList(al);lLabel.setCellFeatures(wcfc);sheet.addCell(lLabel);发现这种方式不行,请大侠们指点
解决方案
解决方案二:
LabellblColumn=null;WritableSheetws=wb.createSheet("标签",0);lblColumn=newLabel(12,nRow,"请选择",fmtCenterCaption);WritableCellFeatureswcf=newWritableCellFeatures();Listangerlist=newArrayList();angerlist.add("电话");angerlist.add("手机");angerlist.add("呼机");wcf.setDataValidationList(angerlist);lblColumn.setCellFeatures(wcf);ws.addCell(lblColumn);
时间: 2024-10-22 14:52:17