I've been able to get this to work with a manually made document and using an empty table cell, so I believe that this should be possible. The following seems to run using python in a linux (Fedora 25) environment but the word document displays the same errors when I try to open the document, however this time the document is recoverable and reverts back to the filler text. I've retrieved what I believe to be the correct xml for a checkbox saved as replacementXML and have inserted filler text into the cells to act as a tag that can be searched and replaced, searchXML. I've tried using the python object functions within python-docx (using get_or_add_tcPr(), etc.) which causes MS Word to throw the following error when I try to open the file, "The file xxxx cannot be opened because there are problems with the contents Details: The file is corrupt and cannot be opened".Īfter struggling with this for a while I moved to a second approach involving manipulating the word/document.xml file for the output doc. All of the formatting has been straightforward and easy so far but I'm completely stumped on how to insert a checkbox into individual table cells. I've been using python to implement a custom parser and use that parsed data to format a word document to be distributed internally.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |