Button class
Button class
Represents the Forms control: Button
The Button type exposes the following members:
Properties
Property | Description |
---|---|
macro_name | Gets and sets the name of macro. |
is_equation | Indicates whether the shape only contains an equation. |
is_smart_art | Indicates whether the shape is a smart art. |
z_order_position | Returns the position of a shape in the z-order. |
name | Gets and sets the name of the shape. |
alternative_text | Returns or sets the descriptive (alternative) text string of the Shape object. |
title | Specifies the title (caption) of the current shape object. |
line_format | Returns a MsoLineFormat object that contains line formatting properties for the specified shape. |
fill_format | Returns a MsoFillFormat object that contains fill formatting properties for the specified shape. |
line | Gets line style |
fill | Returns a Shape.fill_format object that contains fill formatting properties for the specified shape. |
shadow_effect | Represents a ShadowEffect object that specifies shadow effect for the chart element or shape. |
reflection | Represents a ReflectionEffect object that specifies reflection effect for the chart element or shape. |
glow | Represents a GlowEffect object that specifies glow effect for the chart element or shape. |
soft_edges | Gets and sets the radius of blur to apply to the edges, in unit of points. |
three_d_format | Gets and sets 3d format of the shape. |
format_picture | Gets and sets the options of the picture format. |
is_hidden | Indicates whether the object is visible. |
is_lock_aspect_ratio | True means that aspect ratio of the shape is locked. |
is_aspect_ratio_locked | True means that aspect ratio of the shape is locked. |
rotation_angle | Gets and sets the rotation of the shape. |
hyperlink | Gets the hyperlink of the shape. |
id | Gets the identifier of this shape. |
spid | Specifies an optional string identifier that an application can use to identify the particular shape. |
spt | Specifies an optional number that an application can use to associate the particular shape with a defined shape type. |
worksheet | Gets the Shape.worksheet object which contains this shape. |
is_group | Indicates whether this shape is a group shape. |
is_in_group | Indicates whether the shape is grouped. |
is_word_art | Indicates whether this shape is a word art. |
text_effect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Applies to Shape objects that represent WordArt. |
is_locked | True means the object can not be modified when the sheet is protected. Note that this value is meaningful only if the worksheet or objects in the worksheet are protected. |
is_printable | Indicates whether the object is printable. If False, this shape will not be printed when printing. |
mso_drawing_type | Gets drawing type. |
auto_shape_type | Gets and sets the auto shape type. |
anchor_type | Gets and set the type of the shape anchor placeholder. |
placement | Represents 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_row | Represents the top row index. |
upper_delta_y | Gets or sets the shape’s vertical offset from its upper left corner row. |
upper_left_column | Represents upper left corner column index. |
upper_delta_x | Gets or sets the shape’s horizontal offset from its upper left corner column. |
lower_right_row | Represents lower right corner row index. |
lower_delta_y | Gets or sets the shape’s vertical offset from its lower right corner row. |
lower_right_column | Represents lower right corner column index. |
lower_delta_x | Gets or sets the shape’s horizontal offset from its lower right corner column. |
right | Represents the width of the shape’s horizontal offset from its lower right corner column, in unit of pixels. |
bottom | Represents the width of the shape’s vertical offset from its lower bottom corner row, in unit of pixels. |
width | Represents the width of shape, in unit of pixels. |
width_inch | Represents the width of the shape, in unit of inch. |
width_pt | Represents the width of the shape, in unit of point. |
width_cm | Represents the width of the shape, in unit of centimeters. |
height | Represents the height of shape, in unit of pixel. |
height_inch | Represents the height of the shape, in unit of inches. |
height_pt | Represents the height of the shape, in unit of points. |
height_cm | Represents the height of the shape, in unit of centimeters. |
left | Represents the horizontal offset of shape from its left column, in unit of pixels. |
left_inch | Represents the horizontal offset of shape from its left column, in unit of inches. |
left_cm | Represents the horizontal offset of shape from its left column, in unit of centimeters. |
top | Represents the vertical offset of shape from its top row, in unit of pixels. |
top_inch | Represents the vertical offset of shape from its top row, in unit of inches. |
top_cm | Represents the vertical offset of shape from its top row, in unit of centimeters. |
top_to_corner | Gets and sets the vertical offset of shape from worksheet top border, in unit of pixels. |
left_to_corner | Gets and sets the horizonal offset of shape from worksheet left border. |
x | Gets and sets the horizontal offset of shape from worksheet left border,in unit of pixels. |
y | Gets and sets the vertical offset of shape from worksheet top border,in unit of pixels. |
width_scale | Gets 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_scale | Gets 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_shape | Represents 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_shape | Represents 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_shape | Represents the width of the shape, in unit of 1/4000 of the parent shape. |
height_in_shape | Represents the vertical offset of shape from the top border of the parent shape, in unit of 1/4000 of height of the parent shape.. |
group | Gets the group shape which contains this shape. |
type | Gets the auto shape type. |
has_line | Gets and sets the line border of the shape is visible. |
is_filled | Indicates whether the fill format is visible. |
is_flipped_horizontally | Gets and sets whether shape is horizontally flipped . |
is_flipped_vertically | Gets and sets whether shape is vertically flipped . |
actual_lower_right_row | Get the actual bottom row. |
relative_to_original_picture_size | Indicates whether shape is relative to original picture size. |
linked_cell | Gets or sets the worksheet range linked to the control’s value. |
input_range | Gets or sets the worksheet range used to fill the specified combo box. |
text_shape_type | Gets and sets the preset text shape type. |
text_body | Gets and sets the setting of the shape’s text. |
font | Represents the font of shape. |
text_options | Represents the text options of the shape. |
text | Gets and sets the text of this shape. |
is_rich_text | Whether or not the text is rich text. |
html_text | Gets and sets the html string which contains data and some formats in this textbox. |
text_vertical_overflow | Gets and sets the text vertical overflow type of the shape which contains text. |
text_horizontal_overflow | Gets and sets the text horizontal overflow type of the shape which contains text. |
is_text_wrapped | Gets and sets the text wrapped type of the shape which contains text. |
text_orientation_type | Gets and sets the text orientation type of the shape. |
text_horizontal_alignment | Gets and sets the text horizontal alignment type of the shape. |
text_vertical_alignment | Gets and sets the text vertical alignment type of the shape. |
text_direction | Gets/Sets the direction of the text flow for this object. |
control_data | Gets the data of control. |
active_x_control | Gets the ActiveX control. |
paths | Gets the paths of a custom geometric shape. |
geometry | Gets the geometry |
create_id | Gets and sets create id for this shape. |
is_decorative | Indicates whether the object is decorative. |
Methods
Method | Description |
---|---|
to_image | Creates the shape image and saves it to a stream in the specified format. |
to_image | Saves the shape to a file. |
to_image | Saves the shape to a stream. |
get_result_of_smart_art | Converting smart art to grouped shapes. |
to_front_or_back | Brings the shape to the front or sends the shape to back. |
get_locked_property | Gets the value of locked property. |
set_locked_property | Set the locked property. |
add_hyperlink | Adds a hyperlink to the shape. |
remove_hyperlink | Removes the hyperlink of the shape. |
move_to_range | Moves the shape to a specified range. |
align_top_right_corner | Moves the picture to the top-right corner. |
get_connection_points | Get the connection points |
get_linked_cell | Gets the range linked to the control’s value. |
set_linked_cell | Sets the range linked to the control’s value. |
get_input_range | Gets the range used to fill the control. |
set_input_range | Sets the range used to fill the control. |
update_selected_value | Update the selected value by the value of the linked cell. |
calculate_text_size | Recalculate the text area |
format_characters | Formats some characters with the font setting. |
characters | Returns a Characters object that represents a range of characters within the text. |
get_characters | Returns all Characters objects that represents a range of characters within the text . |
get_rich_formattings | Returns all Characters objects that represents a range of characters within the text . |
remove_active_x_control | Remove activeX control. |
is_same_setting | Returns whether the shape is same. |
get_actual_box | Get the actual position and size of the shape (after applying rotation, flip, etc.) |
Example
from aspose.cells import Workbook
from aspose.cells.drawing import PlacementType
from aspose.pydrawing import Color
# Create a new Workbook.
workbook = Workbook()
# Get the first worksheet in the workbook.
sheet = workbook.worksheets[0]
# Add a new button to the worksheet.
button = sheet.shapes.add_button(2, 0, 2, 0, 28, 80)
# Set the caption of the button.
button.text = "Aspose"
# Set the Placement Type, the way the
# button is attached to the cells.
button.placement = PlacementType.FREE_FLOATING
# Set the font name.
button.font.name = "Tahoma"
# Set the caption string bold.
button.font.is_bold = True
# Set the color to blue.
button.font.color = Color.blue
# Set the hyperlink for the button.
button.add_hyperlink("http://www.aspose.com/")
# Saves the file.
workbook.save(r"tstbutton.xls")
See Also
- module
aspose.cells.drawing
- class
Button
- class
GlowEffect
- class
ReflectionEffect
- class
ShadowEffect
- class
Shape