Search code examples
c++qtms-word.doc

How to attach MS word document in Qt GUI application?


I wrote a Qt widget application. In the file menu I want to insert an MS word document as a user manual. Is there any way to do it? I checked Qt help and various blogs but none of them gave me a clear solution.


Solution

  • If it is only manual then it is not necessary to embed MS Word inside your app. Maybe try to open needed document with Word installed in computer. Try this code:

    QDesktopServices::openUrl(QUrl("file:///G:/tst.docx"));
    

    Just set needed path. As doc said:

    If the URL is a reference to a local file (i.e., the URL scheme is "file") then it will be opened with a suitable application instead of a Web browser.