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 项。

属性

名称类型访问描述
typestr读取获取类型。
shape_type`intNone`读取
namestr读取获取名称。
alternative_textstr读取获取替代文本。
width`floatNone`读取
height`floatNone`读取
is_inline`boolNone`读取
has_image`boolNone`读取
image_dataOptional[ImageData]读取获取图像数据。
text_box`dict[str, Any]None`读取
fill_colorstr读取获取填充颜色。
strokeOptional[Border]读取获取笔画。
text_box_anchorint读取获取文本框锚点。
wrap_typeint读取获取换行类型。
relative_horizontal_positionint读取获取相对水平位置。
relative_vertical_positionint读取获取相对垂直位置。
leftfloat读取获取左侧。
topfloat读取获取顶部。
horizontal_alignmentint读取获取水平对齐方式。
vertical_alignmentint读取获取垂直对齐方式。
behind_textbool读取获取后面的文本。
allow_overlapbool读取获取允许重叠。
is_layout_in_cellbool读取获取单元格中的布局状态。
anchor_lockedbool读取获取已锁定的锚点。

方法

签名描述
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。

另请参阅

 中文