Shape
概述
Shape 是 Aspose.Words FOSS 中用于 Python 的一个类。继承自:BaseModel、NodeCastMixin。
Shape 对象公开几何和内容属性,例如 width、height、image_data 和 text_box,并且可以通过 as_body()、as_paragraph() 等方式转换为其他节点类型。
此类提供 8 个方法,用于在 Python 程序中操作 Shape 对象。可用的方法包括:as_body、as_cell、as_paragraph、as_row、as_run、as_section、as_shape、as_table。在安装了 Aspose.Words FOSS for Python 包后,所有公共成员对任何 Python 应用程序均可访问。属性有:allow_overlap、alternative_text、anchor_locked、behind_text、fill_color、has_image,以及其他 18 项。
属性
| 名称 | 类型 | 访问 | 描述 |
|---|---|---|---|
type | str | 读取 | 获取类型。 |
shape_type | `int | None` | 读取 |
name | str | 读取 | 获取名称。 |
alternative_text | str | 读取 | 获取替代文本。 |
width | `float | None` | 读取 |
height | `float | None` | 读取 |
is_inline | `bool | None` | 读取 |
has_image | `bool | None` | 读取 |
image_data | Optional[ImageData] | 读取 | 获取图像数据。 |
text_box | `dict[str, Any] | None` | 读取 |
fill_color | str | 读取 | 获取填充颜色。 |
stroke | Optional[Border] | 读取 | 获取笔画。 |
text_box_anchor | int | 读取 | 获取文本框锚点。 |
wrap_type | int | 读取 | 获取换行类型。 |
relative_horizontal_position | int | 读取 | 获取相对水平位置。 |
relative_vertical_position | int | 读取 | 获取相对垂直位置。 |
left | float | 读取 | 获取左侧。 |
top | float | 读取 | 获取顶部。 |
horizontal_alignment | int | 读取 | 获取水平对齐方式。 |
vertical_alignment | int | 读取 | 获取垂直对齐方式。 |
behind_text | bool | 读取 | 获取后面的文本。 |
allow_overlap | bool | 读取 | 获取允许重叠。 |
is_layout_in_cell | bool | 读取 | 获取单元格中的布局状态。 |
anchor_locked | bool | 读取 | 获取已锁定的锚点。 |
方法
| 签名 | 描述 |
|---|---|
as_body() | 在此 Shape 实例上调用 as_body。 |
as_cell() | 在此 Shape 实例上调用 as_cell。 |
as_paragraph() | 在此 Shape 实例上调用 as_paragraph。 |
as_row() | 在此 Shape 实例上调用 as_row。 |
as_run() | 在此 Shape 实例上调用 as_run。 |
as_section() | 在此 Shape 实例上调用 as_section。 |
as_shape() | 在此 Shape 实例上调用 as_shape。 |
as_table() | 在此 Shape 实例上调用 as_table。 |