Import from Odt

  • 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?

  • @alan73

    Please refer the below link, It may help you.


  • Odt import file is very easy...

    OOReader.h is my work, is a subset from Okular KDE ...
    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;
        QProcess *process = new QProcess(NULL);
        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();

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.