Import from Odt
Unsolved
General and Desktop
-
wrote on 25 Dec 2015, 10:21 last edited by
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?
-
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?
-
wrote on 9 Aug 2017, 14:35 last edited by
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(); }