Issue with ODF files generated
-
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);
}@ -
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. -
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.
-
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/.