openxml

How do I delete particular pages from a DOCX file?

How do I delete particular pages from a DOCX file? Question: I have quite a large collection of DOCX documents, and I need to delete all but the first page in all of them. From what I have read, docx-python does not support this since it has no notion of pages. One option I have …

Total answers: 1

Working with picture in AlternateContent tag

Working with picture in AlternateContent tag Question: I need to move an element from one document to another by using python-docx. The element is AlternateContent which represents shapes and figures in Office Word, the issue here is that one of the elements contains an image like this: <AlternateContent> <Choice Requires="wpc"> <drawing> <inline distT="0" distB="0" distL="0" …

Total answers: 1

Open XML document protection implementation (documentProtection class)

Open XML document protection implementation (documentProtection class) Question: I’m trying to implement the Open XML documentProtection hash protection of a MS Word (2019) document in Python to test the hashing algorithm. So I’ve created a Word document, protected it against editing with this password: johnjohn. Then, opening the document as ZIP/XML, I see the following …

Total answers: 1

Extract DOCX Comments

Extract DOCX Comments Question: I’m a teacher. I want a list of all the students who commented on the essay I assigned, and what they said. The Drive API stuff was too challenging for me, but I figured I could download them as a zip and parse the XML. The comments are tagged in w:comment …

Total answers: 4

How can I search a word in a Word 2007 .docx file?

How can I search a word in a Word 2007 .docx file? Question: I’d like to search a Word 2007 file (.docx) for a text string, e.g., “some special phrase” that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting …

Total answers: 10