Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
4.8.3
-
None
-
QT 4.8.3, Open source (windows x86) version with MingGW GCC 4.4.0, Windows 7 OS (64 bit), QT creator 2.5.2
Description
When QTextDocumentWriter is used to write a ODT file, with the content taken from a QTextEdit, and the text contains Unicode Indic characters, with font information like font name, size, weight, style etc, the resulting ODT file is corrupt.
All word processors fail to open the resulting odt file properly
I tried with following Word Processors
MS word 2010 - Fails to open the file itself, and terms it as corrupt
AbiWord 2.8.6 - Opens but content is invalid/not readable
Calligra 2.5 beta - Opens, content has no formatting information
libreoffice 3.6.2.2 - Opens, content has no formatting information
OpenOffice.org 3.4.1 - Opens, content has no formatting information
Also attaching various error screenshots, the invalid odf file and the program used to generate the file.
Following code was used to generate the file.
#include <QApplication> #include <QtGui> #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); QTextEdit edit; QString content; for (int i = 0; i < 100; i++) content += QChar(0x905); edit.setHtml(content); QTextCursor tc = edit.textCursor(); tc.document()->setDefaultFont(QFont("Arial", 14)); QTextCharFormat tcf = tc.charFormat(); tc.select(QTextCursor::Document); tcf.setFontItalic(true); tcf.setFontWeight(QFont::Bold); tc.mergeCharFormat(tcf); edit.show(); QTextDocumentWriter tdw; tdw.setFormat("odf"); tdw.setFileName("c:/invalid_file.odt"); bool saved = tdw.write(edit.document()); return a.exec(); }
Also note, in the application, the text was set to bold and that also is not visible, as can be seen from the various screenshots provided here.