1

I've tried the following. It involves the use of the convertapi library.

import convertapi                                                                                                       
import os                                                                                                               
import tempfile                                                                                                                                                                                                                                                                                                                                                         

convertapi.api_secret = 'my_secret'                                                                              
print('Converting from .doc(x) to .odt')                                                                                
odt_result = convertapi.convert('odt', { 'File': '/mnt/c/Users/username/Documents/TGMC.docx' })                                 
odt_result.file.save('/mnt/c/Users/fvsha/Documents/TGMC2.odt')                                                          ~       

While it worked, I noticed a change in the automatic chapter numbering. The original document had chapters 1 through 5. The new odt document had chapters 1.1-1.5 followed by chapter 2.

Two questions: What caused this and could you recommend a way to convert the file from .doc/.docx to .odt using Python without having to manually clean up everything afterwards? Thank you.

Victor Simon
  • 75
  • 3
  • 10

0 Answers0