我正在尝试使用以下代码在 JXL API 中显示 ComboBox:
ArrayList<String> arrList = new ArrayList<String>();
arrList.add("DropDown1");
arrList.add("DropDown2");
arrList.add("DropDown3");
WritableCellFeatures cellFeatures = new WritableCellFeatures();
cellFeatures.setDataValidationList(arrList);
Blank b = null;
Label checkLabel = null;
for (int x = 0; x < xlData.size(); x++) {
for (int i = 0; i <= 14; i++) {
System.out.println("X:" + x + "I:" + i);
if (i > 9) {
checkLabel = new Label(i, x + xlHeader.size(),(String) arrList.get(0));
//b = new Blank(i, x + xlHeader.size());
//b.setCellFeatures(cellFeatures);
checkLabel.setCellFeatures(cellFeatures);
writableSheet.addCell(checkLabel);
System.out.println("Combo Cell : " + x + ":" + i);
}
}
}
我已经尝试过“空白”单元和“标签”。但是 Excel 仍然没有显示 ComboBox。