How can I read a Word (.doc) file in Qt? I want the text to appear formatted exactly like the Word document without any loss.
Asked
Active
Viewed 2,252 times
0
-
4Google docs and libreoffice (among many others) have been trying that for years. – cnicutar Aug 19 '12 at 08:13
-
it can be done using active_x object but I'm not able to figure out how. – user1603594 Aug 19 '12 at 08:15
-
Perhaps have a look into RTF instead. Qt has support for rich text. – Bart Aug 19 '12 at 08:50
-
If you go Windows-only, try what Marcus suggests. Cross-platform using Calligra's (http://www.calligra-suite.org) libraries might be the best bet. No third-party solution will give you exactly the same formatting as in Word though. – Frank Osterfeld Aug 19 '12 at 09:38
-
3@cnicutar: not to mention, MS themselves try hard to get the formatting the same between versions. – Caleb Huitt - cjhuitt Aug 23 '12 at 19:20
1 Answers
1
Take a look at this Microsoft Knowledge Base article, it describes where the documentation for the ActiveX objects can be found. ActiveX Widgets can be accesed from Qt via the QAxWidget
, queries are issued using QAxBase::querySubObject()
.
Edit: And take a look at this answer. It adds some code samples to my answer.

Community
- 1
- 1

Marcus Riemer
- 7,244
- 8
- 51
- 76