How can I write an .odt programmatically? [closed]
Writing a library to do this would be considerably harder then your are anticipating.
Instead, convert the .tex file into an intermediary format, such as HTML (or PDF) and then convert it again into .odt using already existing tools.
Source/Example