Important: Please read the Qt Code of Conduct -

Generating doc file using Qt4.3.3

  • How can we generate doc (MS Word document) file using Qt Library? The problem i am facing is that i have generated report on QTextEdit, now i want to export it to doc file. Is it possible at all using Qt4.3.3.

    Thanks & Regards,

  • doc is a closed file format. If you know the specifications (which I doubt you do), you can use QFile to output the data in the form you need. However, that probably is not a good plan.

    What you could do, is export to .rtf. That format is open, and powerful enough for most purposes. Word reads it just fine. Alternatively, export to OpenDocument Format (.odf). Word can read it, (though I heard there are issues with it), and Qt is able to export to it.

    Last, you may choose to use Word itself to write .doc documents, using ActiveX. You can use ActiveX though QAxObject.

  • As Microsoft made a promise to open their file formats it is not so closed any more. You can find the file specifications "here":

  • VCsala, I guess you are right. Now just hope the specifications as written there (I did not go through them) are actually implementable. Anyway, I wish durgeshK a lot of luck doing that, even with the complete specs readily available :-)

  • Thanks guys for the prompt reply, i think i will try exporting to rich text format, as Andre has rightly pointed that, it is very tough and time consuming to go through and understand the whole document.

Log in to reply