0


I wonder how to add checkbox or at least something that is square (I mean, I don't need to check or uncheck it).
I tried this but it doesn't work. I find this but it uses XmlDocx and it needs according to me those xml (that I don't want to integrate with my Odoo module).
I find here how checkbox looks like in xml format

<w:checkBox>
 <w:sizeAuto />
 <w:default w:val="0">
 <w:checked/>
</w:checkBox>

But don't know how to integrate it in Document() object.
Can you help me? Thank you very much.

This is my code in main :

filename = '%s.docx' % self.acronym
logo = base64.b64decode(self.company_id.logo)
logo_filename = "logo.jpg"
full_path_logo = os.path.join('/tmp', logo_filename)
with open(full_path_logo, 'wb') as f:
     f.write(logo)
full_path_filename = os.path.join('/tmp', filename)
document = Document()
style = document.styles['Normal']
font = style.font
font.name = 'Arial'
3
  • Can you share a bit more code? What is the Document() object you referring to? Commented Aug 15, 2019 at 18:04
  • @iddos Document() is the main python-docx object() Commented Aug 16, 2019 at 5:40
  • @m0r7y - For an updated answer please see this. Unfortunately, as MS Word updates its xml this will change, and you'll need to examine the xml in that case. Commented Aug 8, 2024 at 20:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.