public class ListBox 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("Choose Dept:");
//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 list box.
cells.get("A2").putValue("Sales");
cells.get("A3").putValue("Finance");
cells.get("A4").putValue("MIS");
cells.get("A5").putValue("R&D");
cells.get("A6").putValue("Marketing");
cells.get("A7").putValue("HRA");
//Add a new list box.
ListBox listBox = sheet.getShapes().addListBox(2, 0, 3, 0, 122, 100);
//Set the placement type.
listBox.setPlacement(PlacementType.FREE_FLOATING);
//Set the linked cell.
listBox.setLinkedCell("A1");
//Set the input range.
listBox.setInputRange("A2:A7");
//Set the selection style.
listBox.setSelectionType(SelectionType.SINGLE);
//Set the list box with 3-D shading.
listBox.setShadow(true);
//Saves the file.
workbook.save("tstlistbox.xls");
| Modifier and Type | Method and Description |
|---|---|
int |
getItemCount()
Gets the number of items in the list box.
|
int |
getPageChange()
Specifies the amount by which the control's value is changed
when the user clicks on the scrollbar's page up or page down region.
|
Cell[] |
getSelectedCells()
Gets the selected cells.
|
int |
getSelectedIndex()
Gets the index number of the currently selected item in a list box or combo box.
|
int |
getSelectionType()
Gets the selection mode of the specified list box.
|
boolean |
getShadow()
Indicates whether the combobox has 3-D shading.
|
boolean |
isSelected(int itemIndex)
Indicates whether the item is selected.
|
void |
selectedItem(int itemIndex,
boolean isSelected)
Sets whether the item is selected
|
void |
setPageChange(int value)
Specifies the amount by which the control's value is changed
when the user clicks on the scrollbar's page up or page down region.
|
void |
setSelectedIndex(int value)
Sets the index number of the currently selected item in a list box or combo box.
|
void |
setSelectionType(int value)
Sets the selection mode of the specified list 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 getItemCount()
public int getSelectedIndex()
Remarks
-1 presents no item is selected.public void setSelectedIndex(int value)
Remarks
-1 presents no item is selected.public void selectedItem(int itemIndex,
boolean isSelected)
itemIndex - The item indexisSelected - Whether the item is selected.
True means that this item should be selected.
False means that this item should be unselected.public boolean isSelected(int itemIndex)
itemIndex - The item index.public Cell[] getSelectedCells()
public boolean getShadow()
public void setShadow(boolean value)
public int getSelectionType()
See SelectionType.
public void setSelectionType(int value)
See SelectionType.
public int getPageChange()
public void setPageChange(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.