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

doc.Unit(cdrUnit)

毫米、英寸、点、像素等。数值各版本可能不同,最稳的做法是「赋值 → 回读 → 确认」,别硬记数字。

签名

doc.Unit(cdrUnit)

说明

毫米、英寸、点、像素等。数值各版本可能不同,最稳的做法是「赋值 → 回读 → 确认」,别硬记数字。

Python 示例(可直接运行)

依赖 pywin32。示例假定 app / doc / page / layer 已就绪。 见「连接与初始化」
Python
# 单位代号各版本可能不同,最稳的是「赋值 → 回读 → 确认」
def set_unit(doc, code, name):
    doc.Unit = code
    if doc.Unit == code:
        print("已切换为", name)
        return True
    print("代号", code, "无效,实际读回:", doc.Unit)
    return False

set_unit(doc, 6, "毫米")

关于本类:枚举值速查

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

同类其他接口