Hi,
I was trying to insert list box into an excel sheet. When i select the value in the list , it shows me the value of selected index instead of value. I want the selected value to be displayed.
//Create a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet.
Worksheet sheet = workbook.getWorksheets().get(0);
//Get the worksheet cells collection.
Cells cells = sheet.getCells();
//Input a value.
cells.get(“B3”).setValue(“Choose Dept:”);
Style style = cells.get(“B3”).getStyle();
style.getFont().setBold(true);
//Set it bold.
cells.get(“B3”).setStyle(style);
//Input some values that denote the input range for the combo box.
cells.get(“A2”).setValue(“Sales”);
cells.get(“A3”).setValue(“Finance”);
cells.get(“A4”).setValue(“MIS”);
cells.get(“A5”).setValue(“R&D”);
cells.get(“A6”).setValue(“Marketing”);
cells.get(“A7”).setValue(“HRA”);
//Add a new list box.
com.aspose.cells.ListBox listBox = (com.aspose.cells.ListBox)sheet.getShapes().addShape(MsoDrawingType.LIST_BOX,3, 3, 1,0, 100, 122);
//Set the linked cell;
listBox.setLinkedCell(“A1”);
//Set the input range.
listBox.setInputRange("=A2:A7");
//Set the Placement Type, the way the list box is attached to the cells.
listBox.setPlacement(PlacementType.FREE_FLOATING);
//Set the list box with 3-D shading.
listBox.setShadow(true);
//Set the selection type.
listBox.setSelectionType(SelectionType.SINGLE);
//AutoFit Columns
sheet.autoFitColumns();
//Saves the file.
workbook.save(“E:\Excels\tstlistbox.xls”);
Also , is there any style to distinguish between multi select list and single select list. Like , when i open the sheet , i cannot tell whether the list is single select or multi select.