Results 1 to 4 of 4

Thread: Open a PowerPoint inside QMainWindow

  1. #1
    Join Date
    Jan 2013
    Posts
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Open a PowerPoint inside QMainWindow

    Hi,
    with this code I can open PowerPoint files (.ppt or .pptx)

    Qt Code:
    1. FullScreen::FullScreen(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::FullScreen)
    4. {
    5. ui->setupUi(this);
    6.  
    7. QString file_ppt = "C:\\aaa.pptx";
    8.  
    9. // Open parameter
    10. QList<QVariant> param_list;
    11. param_list.append(file_ppt);
    12. param_list.append(1);
    13. param_list.append(0);
    14. param_list.append(0);
    15.  
    16. // Make a object PPT
    17. QAxWidget *obj_ppt = new QAxWidget("Powerpoint.Application", this->ui->slides);
    18. obj_ppt->setGeometry(QRect(0,0,800,600));
    19.  
    20. if(!obj_ppt->setControl("{91493441-5A91-11CF-8700-00AA0060263B}"))
    21. {
    22. QMessageBox::critical(this, trUtf8("Error PPT"), "Install Microsoft Power Point (R) for the support PPT!");
    23. }
    24.  
    25. // Open a template file
    26. QAxObject *presentations = obj_ppt->querySubObject("Presentations");
    27. QAxObject *presentation = presentations->querySubObject("Open(const QString&,int,int,int)", param_list);
    28.  
    29. // Start the slides
    30. QAxObject *slideshow = presentation->querySubObject("SlideShowSettings");
    31. slideshow->setProperty("RangeType", "ppShowAll");
    32. slideshow->dynamicCall("run()");
    33. }
    To copy to clipboard, switch view to plain text mode 

    What I want to obtain, is to show the slide into object QAxWidget called ui->slides centered in my form.
    Instead I get to open the my form with a black rectangle of 800x600 pixels and a full screen slide out of the my form.
    Someone can help me understand where I'm wrong?
    Thanks.
    blackout69

  2. #2
    Join Date
    Jan 2013
    Posts
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Angry Re: Open a PowerPoint inside QMainWindow

    hi,
    I completely changing approach to the my problem, using setControl(), with the following code, I can open a Word document (.doc or .docx) inside my object QAxWidget ui->slides that have already positioned and centered on my form.
    Qt Code:
    1. FullScreen::FullScreen(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::FullScreen)
    4. {
    5. ui->setupUi(this);
    6.  
    7. if(!ui->slides->setControl("Word.Application"))
    8. {
    9. QMessageBox::critical(this, trUtf8("Errore DOC"), "Installare Microsoft Word(R) per il supporto DOC!");
    10. }
    11. ui->slides->setControl("C:\\aaa.docx");
    12. }
    To copy to clipboard, switch view to plain text mode 
    But following the same code for PowerPoint files (.ppt or .pptx), my item QAxWidget ui->slides become all white and the content of aaa.pptx will not appear. By controlling the task of Windows, I see that the program powerpnt.exe is running, only that the file aaa.pptx not shown.
    There is anyone who has worked with objects QAxWidget to help me to understand where I'm wrong?
    Qt Code:
    1. FullScreen::FullScreen(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::FullScreen)
    4. {
    5. ui->setupUi(this);
    6.  
    7. if(!ui->slides->setControl("PowerPoint.Application"))
    8. {
    9. QMessageBox::critical(this, trUtf8("Errore PPT"), "Installare Microsoft Power Point (R) per il supporto PPT!");
    10. }
    11. ui->slides->setControl("C:\\aaa.pptx");
    12. }
    To copy to clipboard, switch view to plain text mode 
    thank you in advance
    blackout69

  3. #3
    Join Date
    Sep 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Open a PowerPoint inside QMainWindow


  4. #4
    Join Date
    Jan 2013
    Posts
    3
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Open a PowerPoint inside QMainWindow

    Thank zhaolan94 for your replay, but he did not understand how.
    You could make a simple example?
    Thank you

Similar Threads

  1. Draw with OPenGL inside QMAinWindow
    By zulunation in forum Newbie
    Replies: 10
    Last Post: 12th November 2014, 11:35
  2. Access widget inside the QMainWindow centralwidget
    By graciano in forum Qt Programming
    Replies: 4
    Last Post: 23rd January 2014, 21:40
  3. How to open an external App inside QMainWindow
    By lorik in forum Qt Programming
    Replies: 5
    Last Post: 29th December 2011, 01:07
  4. [SOLVED] QMainWindow open a new QMainWindow
    By xeroblast in forum Qt Programming
    Replies: 1
    Last Post: 2nd December 2010, 07:31
  5. QMainWindow inside another widget
    By DanFessler in forum Newbie
    Replies: 4
    Last Post: 23rd August 2010, 21:58

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.