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. Import from Odt
Qt 6.11 is out! See what's new in the release blog

Import from Odt

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt4.8qtextdocumentqt5
3 Posts 3 Posters 2.0k Views
  • 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
    alan73
    wrote on last edited by
    #1

    Hello!

    There is an ability to export to Odt from QTextDocument with the help of QTextDocumentWriter in Qt. Is there any way to import to QTextDocument from Odt?

    B 1 Reply Last reply
    0
    • A alan73

      Hello!

      There is an ability to export to Odt from QTextDocument with the help of QTextDocumentWriter in Qt. Is there any way to import to QTextDocument from Odt?

      B Offline
      B Offline
      Bagavathi
      wrote on last edited by
      #2

      @alan73

      Please refer the below link, It may help you.

      OOReader

      1 Reply Last reply
      0
      • P Offline
        P Offline
        patrik08
        wrote on last edited by
        #3

        Odt import file is very easy...

        OOReader.h is my work, is a subset from Okular KDE ...
        https://github.com/pehohlva/fop-miniscribus/blob/master/OO_Widged/oasis/OOReader.h
        2017 the best way is now textutil from mac it convert doc rtf docx odt and many other format to txt or html to play in QTextedit ...

        void ZipDoc::handler_txtutils( const QString file ) {
        	qDebug() << "### handler use-> " <<  __FUNCTION__;
             //// converter = /usr/bin/textutil
             if (converter.size() < 4) {
               text_s = QString("textutil -convert .. unable to read! or not mac osx.");
             }
            //// ram->LoadFile(file);
            //// const QByteArray base = ram->stream();
             QTime myTimer;
             myTimer.start();
            QProcess *process = new QProcess(NULL);
            process->setReadChannelMode(QProcess::MergedChannels);
            process->start(converter,  QStringList() << "-convert" << "txt" << file << "-stdout", QIODevice::ReadOnly );
              if (!process->waitForFinished()) {
                   text_s = QString("Unable to read!.");
              } else {
                   text_s = strip_tag(process->readAll());
              }
        
              qDebug() << "### handler_txtutils time-> " << myTimer.elapsed();
        }
        
        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