odtファイルを編集するには、私の答えは役に立たないかもしれませんが、新しいodtファイルを作成する場合は、PyQt4でQTextDocument、QTextCursor、およびQTextDocumentWriterを使用できます。odtファイルへの書き込み方法を示す簡単な例:
>>>from pyqt4 import QtGui
# Create a document object
>>>doc = QtGui.QTextDocument()
# Create a cursor pointing to the beginning of the document
>>>cursor = QtGui.QTextCursor(doc)
# Insert some text
>>>cursor.insertText('Hello world')
# Create a writer to save the document
>>>writer = QtGui.QTextDocumentWriter()
>>>writer.supportedDocumentFormats()
[PyQt4.QtCore.QByteArray(b'HTML'), PyQt4.QtCore.QByteArray(b'ODF'), PyQt4.QtCore.QByteArray(b'plaintext')]
>>>odf_format = writer.supportedDocumentFormats()[1]
>>>writer.setFormat(odf_format)
>>>writer.setFileName('hello_world.odt')
>>>writer.write(doc) # Return True if successful
True
QTextCursorは、テーブル、フレーム、ブロック、画像を挿入することもできます。詳しくは。詳細については、http:
//qt-project.org/doc/qt-4.8/qtextcursor.htmlをご覧ください。
ボーナスとして、QPrinterを使用してPDFファイルに印刷することもできます。