简体   繁体   中英

Possible to Insert page in word document with python-docx?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM