首页/ 接口索引/ 枚举值速查

AlignToShape 的 type = -1

水平垂直都居中。你代码里对标题文字用的就是这个。

名称

AlignToShape 的 type = -1

说明

水平垂直都居中。你代码里对标题文字用的就是这个。

Python 示例(可直接运行)

依赖 pywin32。示例假定 app / doc / page / layer 已就绪。 见「连接与初始化」
Python
shape = app.ActiveSelectionRange(1)
other = doc.ActivePage.Shapes.Item(2)

# -1 = 水平垂直都居中
shape.AlignToShape(-1, other)
print("已居中到目标对象上")

# 其他对齐值见 cdrAlignType,按需一个个试

关于本类:枚举值速查

Python 里没有常量名,只能写数字。下面这些是常用且已核对过的。

同类其他接口