ComboBox class

ComboBox class

Represents the control form ComboBox.

Inheritance: ComboBoxShape

The ComboBox type exposes the following members:

Properties

PropertyDescription
macro_nameGets and sets the name of macro.
is_equationIndicates whether the shape only contains an equation.
is_smart_artIndicates whether the shape is smart art.
z_order_positionReturns the position of a shape in the z-order.
nameGets and sets the name of the shape.
alternative_textReturns or sets the descriptive (alternative) text string of the Shape object.
titleSpecifies the title (caption) of the current shape object.
line_formatReturns a MsoLineFormat object that contains line formatting properties for the specified shape.
fill_formatReturns a MsoFillFormat object that contains fill formatting properties for the specified shape.
lineGets line style
fillReturns a Shape.fill_format object that contains fill formatting properties for the specified shape.
shadow_effectRepresents a ShadowEffect object that specifies shadow effect for the chart element or shape.
reflectionRepresents a ReflectionEffect object that specifies reflection effect for the chart element or shape.
glowRepresents a GlowEffect object that specifies glow effect for the chart element or shape.
soft_edgesGets and sets the radius of blur to apply to the edges, in unit of points.
three_d_formatGets and sets 3d format of the shape.
text_frameReturns a TextFrame object that contains the alignment and anchoring properties for the specified shape.
format_pictureGets and sets the options of the picture format.
is_hiddenIndicates whether the object is visible.
is_lock_aspect_ratioTrue means that don’t allow changes in aspect ratio.
rotation_angleGets and sets the rotation of the shape.
hyperlinkGets the hyperlink of the shape.
idGets the identifier of this shape.
spidSpecifies an optional string that an application can use to Identify the particular shape.
sptSpecifies an optional number that an application can use to associate the particular shape with a defined shape type.
worksheetGets the Shape.worksheet object which contains this shape.
is_groupIndicates whether the shape is a group.
is_in_groupIndicates whether the shape is grouped.
is_word_artIndicates whether this shape is a word art.
text_effectReturns a TextEffectFormat object that contains text-effect formatting properties for the specified shape.
Applies to Shape objects that represent WordArt.
is_lockedTrue if the object is locked, False if the object can be modified when the sheet is protected.
is_printableTrue if the object is printable
mso_drawing_typeGets mso drawing type.
auto_shape_typeGets and sets the auto shape type.
anchor_typeGets and set the shape anchor placeholder.
placementRepresents the way the drawing object is attached to the cells below it.
The property controls the placement of an object on a worksheet.
upper_left_rowRepresents upper left corner row index.
upper_delta_yGets or sets the shape’s vertical offset from its upper left corner row.
upper_left_columnRepresents upper left corner column index.
upper_delta_xGets or sets the shape’s horizontal offset from its upper left corner column.
lower_right_rowRepresents lower right corner row index.
lower_delta_yGets or sets the shape’s vertical offset from its lower right corner row.
lower_right_columnRepresents lower right corner column index.
lower_delta_xGets or sets the shape’s horizontal offset from its lower right corner column.
rightRepresents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels.
bottomRepresents the width of the shape’s vertical offset from its lower bottom corner row, in unit of pixels.
widthRepresents the width of shape, in unit of pixels.
width_inchRepresents the width of the shape, in unit of inch.
width_ptRepresents the width of the shape, in unit of point.
width_cmRepresents the width of the shape, in unit of centimeters.
heightRepresents the height of shape, in unit of pixel.
height_inchRepresents the height of the shape, in unit of inches.
height_ptRepresents the height of the shape, in unit of points.
height_cmRepresents the height of the shape, in unit of centimeters.
leftRepresents the horizontal offset of shape from its left column, in unit of pixels.
left_inchRepresents the horizontal offset of shape from its left column, in unit of inches.
left_cmRepresents the horizontal offset of shape from its left column, in unit of centimeters.
topRepresents the vertical offset of shape from its top row, in unit of pixels.
top_inchRepresents the vertical offset of shape from its top row, in unit of inches.
top_cmRepresents the vertical offset of shape from its top row, in unit of centimeters.
top_to_cornerGets and sets the vertical offset of shape from worksheet top border, in unit of pixels.
left_to_cornerGets and sets the horizonal offset of shape from worksheet left border.
xGets and sets the horizontal offset of shape from worksheet left border,in unit of pixels.
yGets and sets the vertical offset of shape from worksheet top border,in unit of pixels.
width_scaleGets and sets the width scale, in unit of percent of the original picture width.
If the shape is not picture ,the WidthScale property only returns 100;
height_scaleGets and sets the height scale,in unit of percent of the original picture height.
If the shape is not picture ,the HeightScale property only returns 100;
top_in_shapeRepresents the vertical offset of shape from the top border of the parent shape,
in unit of 1/4000 of height of the parent shape.
left_in_shapeRepresents the horizontal offset of shape from the left border of the parent shape,
in unit of 1/4000 of width of the parent shape.
width_in_shapeRepresents the width of the shape, in unit of 1/4000 of the parent shape.
height_in_shapeRepresents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape..
groupGets the group shape which contains this shape.
typeGets the auto shape type.
has_lineGets and sets the line border of the shape is visible.
is_filledIndicates whether the fill format is visible.
is_flipped_horizontallyGets and sets whether shape is horizontally flipped .
is_flipped_verticallyGets and sets whether shape is vertically flipped .
actual_lower_right_rowGet the actual bottom row.
connection_pointsGet the connection points
relative_to_original_picture_sizeIndicates whether shape is relative to original picture size.
linked_cellGets or sets the worksheet range linked to the control’s value.
input_rangeGets or sets the worksheet range used to fill the specified combo box.
text_shape_typeGets and sets the preset text shape type.
text_bodyGets and sets the setting of the shape’s text.
fontRepresents the font of shape.
text_optionsRepresents the text options of the shape.
textRepresents the string in this TextBox object.
is_rich_textWhether or not the text is rich text.
html_textGets and sets the html string which contains data and some formats in this textbox.
text_vertical_overflowGets and sets the text vertical overflow type of the shape which contains text.
text_horizontal_overflowGets and sets the text horizontal overflow type of the shape which contains text.
is_text_wrappedGets and sets the text wrapped type of the shape which contains text.
text_orientation_typeGets and sets the text orientation type of the shape.
text_horizontal_alignmentGets and sets the text horizontal alignment type of the shape.
text_vertical_alignmentGets and sets the text vertical alignment type of the shape.
text_directionGets/Sets the direction of the text flow for this object.
control_dataGets the data of control.
active_x_controlGets the ActiveX control.
pathsGets the paths of a custom geometric shape.
geometryGets the geometry
create_idGets and sets create id for this shape.
selected_indexGets or sets the index number of the currently selected item in a list box or combo box.
Zero-based.
selected_valueGets the selected value of the combox box.
selected_cellGets the selected cell in the input range of the combo box.
shadowIndicates whether the combobox has 3-D shading.
drop_down_linesGets or sets the number of list lines displayed in the drop-down portion of a combo box.

Methods

MethodDescription
to_imageCreates the shape image and saves it to a stream in the specified format.
to_imageSaves the shape to a file.
to_imageSaves the shape to a stream.
format_charactersFormats some characters with the font setting.
format_charactersFormats some characters with the font setting.
get_result_of_smart_artConverting smart art to grouped shapes.
to_front_or_backBrings the shape to the front or sends the shape to back.
get_locked_propertyGets the value of locked property.
set_locked_propertySet the locked property.
add_hyperlinkAdds a hyperlink to the shape.
remove_hyperlinkRemove the hyperlink of the shape.
move_to_rangeMoves the shape to a specified range.
align_top_right_cornerMoves the picture to the top-right corner.
get_connection_pointsGet the connection points
get_linked_cellGets the range linked to the control’s value.
set_linked_cellSets the range linked to the control’s value.
get_input_rangeGets the range used to fill the control.
set_input_rangeSets the range used to fill the control.
update_selected_valueUpdate the selected value by the value of the linked cell.
calculate_text_sizeRecalculate the text area
charactersReturns a Characters object that represents a range of characters within the text.
get_charactersReturns all Characters objects
that represents a range of characters within the text .
get_rich_formattingsReturns all Characters objects
that represents a range of characters within the text .
remove_active_x_controlRemove activeX control.
is_same_settingReturns whether the shape is same.
get_actual_boxGet the actual position and size of the shape (after applying rotation, flip, etc.)

Example

from aspose.cells import Workbook

# Create a new Workbook.
workbook = Workbook()
# Get the first worksheet.
sheet = workbook.worksheets[0]
# Get the worksheet cells collection.
cells = sheet.cells
# Input a value.
cells.get("B3").put_value("Employee:")
# Set it bold.
style = cells.get("B3").get_style()
style.font.is_bold = True
cells.get("B3").set_style(style)
# Input some values that denote the input range
# for the combo box.
cells.get("A2").put_value("Emp001")
cells.get("A3").put_value("Emp002")
cells.get("A4").put_value("Emp003")
cells.get("A5").put_value("Emp004")
cells.get("A6").put_value("Emp005")
cells.get("A7").put_value("Emp006")
# Add a new combo box.
comboBox = sheet.shapes.add_combo_box(2, 0, 2, 0, 22, 100)
# Set the linked cell;
comboBox.linked_cell = "A1"
# Set the input range.
comboBox.input_range = "A2:A7"
# Set no. of list lines displayed in the combo
# box's list portion.
comboBox.drop_down_lines = 5
# Set the combo box with 3-D shading.
comboBox.shadow = True
# AutoFit Columns
sheet.auto_fit_columns()
# Saves the file.
workbook.save(r"tstcombobox.xls")

See Also