Generate an odt file from another program

Hi, I’m learning programming and I would like to know how to generate text and styles to make an odt file.
Something simple like:
Heading 1
Some text
Heading 2
More text.

Thanks a lot!

This is not going to be an easy task…

  1. Type in some text and mark as Heading 1 style.
  2. Save the file in ODT.
  3. Rename extension of file from odt to zip in operating system file manager.
  4. Unzip the file.
  5. Look into content.xml file.

Do you have to create the document with manually create XML, or by scripting OpenOffice.org / LibreOffice, or something in the middle? There are some libraries that can be used to generate Open Document Format. For example these 2 are for Perl: