首页/ 接口索引/ Document 文档对象

doc.AddPages(n)

在末尾追加 n 页。代码里的写法 while len(doc.Pages) < page_index: doc.AddPages(1) 就是「不够就补」。注意 Python 里 len(doc.Pages) 不一定生效,稳妥用 doc.Pages.Count。

签名

doc.AddPages(n)

说明

在末尾追加 n 页。代码里的写法 while len(doc.Pages) < page_index: doc.AddPages(1) 就是「不够就补」。注意 Python 里 len(doc.Pages) 不一定生效,稳妥用 doc.Pages.Count。

Python 示例(可直接运行)

依赖 pywin32。示例假定 app / doc / page / layer 已就绪。 见「连接与初始化」
Python
need = 5                                # 需要 5 页
while doc.Pages.Count < need:           # 不够就一直补
    doc.AddPages(1)                     # 每次在末尾加 1 页

print("当前页数:", doc.Pages.Count)

关于本类:Document 文档对象

管页、管单位、管保存导出,也是「批量撤销」的开关所在。

同类其他接口