Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Issue with ODF files generated

Issue with ODF files generated

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ahdev
    wrote on last edited by
    #1

    I have created a small program to create an ODT file using QTextDocumentWriter. It is creating the file but Word 2010 says its corrupt when I try to open it. Can someone please help.

    The code is:
    @void MainWindow::on_pushButton_clicked()
    {
    QTextDocument *repdoc = new QTextDocument;
    QString reptext;
    reptext = ui->textEdit->toPlainText();
    repdoc->setPlainText(reptext);
    QTextDocumentWriter owriter;
    owriter.setFormat("odf");
    owriter.setFileName("odtfile.odt");
    owriter.write(repdoc);
    }@

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      The compatibility of QTextDocumentWriter with "odf" isn't very good... better don't rely on it.
      Also see "this bug":https://bugreports.qt-project.org/browse/QTBUG-27683.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ahdev
        wrote on last edited by
        #3

        Many thanks Raven for the reply.

        Is there any other way to generate a rich text document [odt / doc / docx / rtf]? If yes can you please suggests the functions that I can look at.

        Thanks in advance.

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          no i don't have experience with these...
          But a quick look showed up a (far away from completeness) "wiki-page":http://qt-project.org/wiki/Handling_Microsoft_Word_file_format and an "external library for processing the RTF format":http://sourceforge.net/projects/librtf/.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved