Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Issue with ODF files generated

    General and Desktop
    2
    4
    1044
    Loading More Posts
    • 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
      ahdev last edited by

      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 Reply Quote 0
      • raven-worx
        raven-worx Moderators last edited by

        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 Reply Quote 0
        • A
          ahdev last edited by

          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 Reply Quote 0
          • raven-worx
            raven-worx Moderators last edited by

            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 Reply Quote 0
            • First post
              Last post