可以使用python-docx在Word文档中插入页面吗? [英] Possible to Insert page in word document with python-docx?

查看:1103
本文介绍了可以使用python-docx在Word文档中插入页面吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是通读了python-docx上的文档.

他们多次提到在文档末尾创建了添加的内容,但是我没有发现任何改变此功能的方法.

有人知道如何将新页面添加到现有文档中,但是将其设为第1页吗?

谢谢!

解决方案

简短的答案是该库尚不支持该功能,尽管这些功能在待办事项列表中很高,因此将是下一个要实现的功能. /p>

要同时完成此操作,您需要使用解决方法"功能降至XML级别.如果您想在GitHub上针对此问题添加此用例,我将整理一些您可以使用的变通方法代码. https://github.com/python-openxml/python-docx/issues/27

I just read through the documentation on python-docx.

They mention several times that added content is created at the end of the document, but I didn't notice any way to alter this functionality.

Does anyone know how to add a new page to a pre-existing document, but make it page 1?

Thanks!

解决方案

The short answer is the library doesn't support that just yet, although those features are high on the backlog so will be among the next to be implemented.

To get it done in the meantime you'll need to go down to the XML level with a "workaround" function. If you want to add this use case on this issue on GitHub I'll put together some workaround code you can use. https://github.com/python-openxml/python-docx/issues/27

这篇关于可以使用python-docx在Word文档中插入页面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆