Results 1 to 2 of 2

Thread: How to embed PPT in Qwidget

  1. #1
    Join Date
    Sep 2014
    Posts
    94
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default How to embed PPT in Qwidget

    Hi,


    I am trying to embed PPTViewer application in QAxWidget but it is showing blank .plz help here is my code...

    QString nPath;
    nPath = QFileDialog::getOpenFileName(this,"select PPT files",qApp->applicationDirPath(),"*.ppt *.pptx");

    QAxWidget *m_pAxWidget = new QAxWidget(this);
    if(!m_pAxWidget->setControl("PowerPoint.Application"))
    {
    QMessageBox::critical(this, trUtf8("Error PPT"), "Install Microsoft Power Point (R) for support PPT!");
    }
    ui->gridLayout->addWidget(m_pAxWidget);
    m_pAxWidget->setControl(nPath );

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to embed PPT in Qwidget

    So, you check the error in the first call to setControl(), but then you just continue on and call setControl() again, this time with the name of the document file instead. If it didn't work the first way, why do you think it would work the second time instead?

    I hope you realize that this question is exactly the same as the question you asked a few days ago about WordViewer. If your system doesn't have the proper ActiveX controls for viewing MS Office documents installed, no amount of variation on the way you try to instantiate the ActiveX controls is going to make them magically display the documents on screen.

    Instead of wasting time posting different versions of a question who cause is the same problem, why don't you investigate what is wrong with your system configuration and fix it?

    You are also relying on a multiple-step process by which Windows has to (1) parse the name of the document, (2) determine the type of document it is (solely from its extension in this case), (3) look up in the Registry the correct ActiveX server that is registered as the handler for such documents, (4) instantiate the server process, (5) load the document into the server process, (6) find an ActiveX control within the server that can display the document on-screen, (7) instantiate the display control, and finally (8) render the document into the display control. And your code is doing this without error-checking anywhere.

    The best way for you to implement what you want to do is to read the documentation on QAxBase::setControl(), look up the CLSID for the Word / PPT / Excel / Visio / whatever servers you want to use, instantiate them using the low-level CLSID-based calls, then use the COM classes in the MS Office COM Automation objects to open and display your documents. If you rely on WIndows to do all the work for you based on a high-level procedure, you have no way to determine what is going wrong or why.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Embed VNC Viewer
    By NoRulez in forum Qt Programming
    Replies: 4
    Last Post: 15th March 2021, 17:03
  2. How to embed WordViewer in qwidget
    By mouni in forum Qt Programming
    Replies: 3
    Last Post: 4th August 2016, 17:15
  3. Is there a way to embed QWidget into a browser?
    By lni in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2014, 23:25
  4. QAxServer. How to embed QWidget into .NET forrm?
    By ivigasin in forum Qt Programming
    Replies: 3
    Last Post: 29th November 2012, 11:42
  5. Replies: 10
    Last Post: 11th June 2012, 10:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.