I need to create a .odt file that contains headings (such as heading 1 or heading 2) and tables.

I tried something like this:
Qt Code:
  1. #include <QString>
  2. #include <QTextStream>
  3. #include <QTextDocument>
  4. #include <QTextDocumentWriter>
  5.  
  6. int main(void)
  7. {
  8. QString strStream;
  9. QTextStream out(&strStream);
  10.  
  11. QTextDocument *document = new QTextDocument();
  12.  
  13. out << "<!DOCTYPE html>"
  14. << "<html>\n"
  15. << "<head>"
  16. << "<title>Test</title>"
  17. << "</head>"
  18. << "<body>"
  19. << "<h1>Test heading 1</h1>"
  20. << "</body>"
  21. << "</html>";
  22. document->setHtml(strStream);
  23.  
  24. QTextDocumentWriter writer("test.odt");
  25.  
  26. writer.setFormat("odf");
  27. writer.write(document);
  28.  
  29. delete document;
  30. return 0;
  31. }
To copy to clipboard, switch view to plain text mode 

but the product .odt file has no heading.
Screenshot_2018-08-01_16-50-50.png
what I would like to be heading 1 doesn't have the Heading 1 style, but, in fact, it's a Default Style bold text.

How do I force Heading 1 style?

best regards
Max