仅适用于搜索此博客条目的人......
from win32com.client import Dispatch
#open Word
word = Dispatch('Word.Application')
word.Visible = False
word = word.Documents.Open(doc_path)
#get number of sheets
word.Repaginate()
num_of_sheets = word.ComputeStatistics(2)
Run Code Online (Sandbox Code Playgroud)
您可以读取该值
\n\n<Properties>\n<Pages>CountValue</Pages>\nRun Code Online (Sandbox Code Playgroud)\n\n来自 docx 包中的 docProps/app.xml 或
\n\n<office:document-meta>\n <office:meta>\n <meta:document-statistic meta:page-count="CountValue">\nRun Code Online (Sandbox Code Playgroud)\n\n在odt包中形成meta.xml。
\n\n如果这些值\xe2\x80\x8b\xe2\x80\x8b不存在(它们是可选的),你必须对整个文档进行计算,实际上是执行渲染,那就更困难了
\n| 归档时间: |
|
| 查看次数: |
7061 次 |
| 最近记录: |