public class ComboBox extends Shape
Example
//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").putValue("Employee:");
//Set it bold.
Style style = cells.get("B3").getStyle();
style.getFont().setBold(true);
cells.get("B3").setStyle(style);
//Input some values that denote the input range
//for the combo box.
cells.get("A2").putValue("Emp001");
cells.get("A3").putValue("Emp002");
cells.get("A4").putValue("Emp003");
cells.get("A5").putValue("Emp004");
cells.get("A6").putValue("Emp005");
cells.get("A7").putValue("Emp006");
//Add a new combo box.
ComboBox comboBox = sheet.getShapes().addComboBox(2, 0, 2, 0, 22, 100);
//Set the linked cell;
comboBox.setLinkedCell("A1");
//Set the input range.
comboBox.setInputRange("A2:A7");
//Set no. of list lines displayed in the combo
//box's list portion.
comboBox.setDropDownLines(5);
//Set the combo box with 3-D shading.
comboBox.setShadow(true);
//AutoFit Columns
sheet.autoFitColumns();
//Saves the file.
workbook.save("tstcombobox.xls");
| Modifier and Type | Method and Description |
|---|---|
int |
getDropDownLines()
Gets the number of list lines displayed in the drop-down portion of a combo box.
|
Cell |
getSelectedCell()
Gets the selected cell in the input range of the combo box.
|
int |
getSelectedIndex()
Gets the index number of the currently selected item in a list box or combo box.
|
java.lang.String |
getSelectedValue()
Gets the selected value of the combox box.
|
boolean |
getShadow()
Indicates whether the combobox has 3-D shading.
|
void |
setDropDownLines(int value)
Sets the number of list lines displayed in the drop-down portion of a combo box.
|
void |
setSelectedIndex(int value)
Sets the index number of the currently selected item in a list box or combo box.
|
void |
setShadow(boolean value)
Indicates whether the combobox has 3-D shading.
|
addHyperlink, alignTopRightCorner, calculateTextSize, characters, fitToTextSize, formatCharacters, getActiveXControl, getActualBox, getActualLowerRightRow, getAlternativeText, getAnchorType, getAutoShapeType, getBottom, getCharacters, getConnectionPoints, getControlData, getCreateId, getFill, getFillFormat, getFont, getFormatPicture, getGeometry, getGlow, getGroup, getHeight, getHeightCM, getHeightInch, getHeightInShape, getHeightPt, getHeightScale, getHtmlText, getHyperlink, getId, getInputRange, getInputRange, getLeft, getLeftCM, getLeftInch, getLeftInShape, getLeftToCorner, getLine, getLineFormat, getLinkedCell, getLinkedCell, getLockedProperty, getLowerDeltaX, getLowerDeltaY, getLowerRightColumn, getLowerRightRow, getMacroName, getMsoDrawingType, getName, getPaths, getPlacement, getReflection, getRelativeToOriginalPictureSize, getResultOfSmartArt, getRichFormattings, getRight, getRotationAngle, getShadowEffect, getSoftEdges, getSpid, getSpt, getText, getTextBody, getTextBoxOptions, getTextDirection, getTextEffect, getTextHorizontalAlignment, getTextHorizontalOverflow, getTextOptions, getTextOrientationType, getTextShapeType, getTextVerticalAlignment, getTextVerticalOverflow, getThreeDFormat, getTitle, getTop, getTopCM, getTopInch, getTopInShape, getTopToCorner, getType, getUpperDeltaX, getUpperDeltaY, getUpperLeftColumn, getUpperLeftRow, getWidth, getWidthCM, getWidthInch, getWidthInShape, getWidthPt, getWidthScale, getWorksheet, getX, getY, getZOrderPosition, hasLine, isAspectRatioLocked, isDecorative, isEquation, isFilled, isFlippedHorizontally, isFlippedVertically, isGroup, isHidden, isInGroup, isLockAspectRatio, isLocked, isPrintable, isRichText, isSameSetting, isSmartArt, isTextWrapped, isWordArt, moveToRange, removeActiveXControl, removeHyperlink, setAlternativeText, setAnchorType, setAspectRatioLocked, setAutoShapeType, setBottom, setCreateId, setDecorative, setFilled, setFlippedHorizontally, setFlippedVertically, setFont, setHasLine, setHeight, setHeightCM, setHeightInch, setHeightInShape, setHeightPt, setHeightScale, setHidden, setHtmlText, setInputRange, setInputRange, setLeft, setLeftCM, setLeftInch, setLeftInShape, setLeftToCorner, setLinkedCell, setLinkedCell, setLockAspectRatio, setLocked, setLockedProperty, setLowerDeltaX, setLowerDeltaY, setLowerRightColumn, setLowerRightRow, setMacroName, setName, setPlacement, setPrintable, setRelativeToOriginalPictureSize, setRight, setRotationAngle, setSoftEdges, setText, setTextDirection, setTextHorizontalAlignment, setTextHorizontalOverflow, setTextOptions, setTextOrientationType, setTextShapeType, setTextVerticalAlignment, setTextVerticalOverflow, setTextWrapped, setTitle, setTop, setTopCM, setTopInch, setTopInShape, setTopToCorner, setUpperDeltaX, setUpperDeltaY, setUpperLeftColumn, setUpperLeftRow, setWidth, setWidthCM, setWidthInch, setWidthInShape, setWidthPt, setWidthScale, setX, setY, setZOrderPosition, toFrontOrBack, toImage, toImage, toImage, updateSelectedValuepublic int getSelectedIndex()
Remarks
-1 presents no item is selected.public void setSelectedIndex(int value)
Remarks
-1 presents no item is selected.public java.lang.String getSelectedValue()
public Cell getSelectedCell()
public boolean getShadow()
public void setShadow(boolean value)
public int getDropDownLines()
public void setDropDownLines(int value)
See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.