相关疑难解决方法(0)

页码python-docx

我试图在python中创建一个程序,可以在.docx文件中找到特定的单词并返回它发生的页码.到目前为止,在查看python-docx文档时,我一直无法找到如何访问页码或甚至是数字所在的页脚.有没有办法使用python-docx或甚至只是python?或者如果没有,最好的方法是什么?

python docx python-docx

8
推荐指数
1
解决办法
4702
查看次数

docx-python word doc 分页符

我正在尝试使用 docx-python 库在文档中间添加分页符。

似乎在添加分页符时,分页符被添加到文档的末尾。有没有一种方法可以将分页符添加到特定位置?

这是我目前的代码。

from docx import Document
from docx.shared import Inches

demo='gm.docx'
document = Document(docx=demo)

for paragraph in document.paragraphs:
    if 'PUB' in paragraph.text:
        document.add_page_break()

document.save('gm.docx')
Run Code Online (Sandbox Code Playgroud)

python split python-docx

6
推荐指数
1
解决办法
9767
查看次数

标签 统计

python ×2

python-docx ×2

docx ×1

split ×1