Results 1 to 3 of 3

Thread: Embed Excel in QT window with toolbars showing

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2021
    Qt products

    Default Embed Excel in QT window with toolbars showing


    Have spent several days trying things from numerous threads on this forum but cannot seem to get the result I need.

    I need to embed excel within a QT window, showing all excel toolbars as well as the spreadsheet cells. Excel must show within a QT window rather than launching a new instance of Excel.

    If I open the desired spreadsheet file directly i.e. ui->excel->setControl("c:\\test\\book.xlsx"); then the spreadsheet displays within the QAxWidget - which is good, but the toolbars are hidden and I cannot seem to make them visible (some attempts below). If I use ui->excel=new QAxWidget("Excel.Application") then open the spreadsheet using ui->excel->querySubObject("WorkBooks")->dynamicCall("Open (const QString&)", QString("c:\\test\\book.xlsx")); the Excel toolbars are visible but Excel is in a separate window and excel is shown in the taskbar rather than being embedded within QT.

    Any help would be greatly appreciated!!


    Qt Code:
    1. ui->excel=new QAxWidget("Excel.Application");
    2. ui->gridLayout->addWidget(ui->excel);
    3. //ui->excel->querySubObject("WorkBooks")->dynamicCall("Open (const QString&)", QString("c:\\test\\book.xlsx"));
    4. ui->excel->setControl("c:\\test\\book.xlsx");
    5. ui->excel->querySubObject("ActiveWorkBook");
    6. ui->excel->setProperty("Visible", true);
    7. ui->excel->setProperty("Caption", "Qt Excel"); //Titled Qt Excel
    8. ui->excel->setProperty("DisplayAlerts", true);
    9. ui->excel->setProperty("DisplayFullScreen", false);
    10. ui->excel->dynamicCall("CommandBars("MyToolbar").Enabled = true");
    11. ui->excel->dynamicCall("CommandBars("Worksheet Menu Bar").Enabled = true");
    12. ui->excel->dynamicCall("CommandBars("MyToolbar").Enabled = true");
    13. ui->excel->dynamicCall("CommandBars("Worksheet Menu Bar").Visible = true");
    14. ui->excel->dynamicCall("show.toolbar("Ribbon",True");
    To copy to clipboard, switch view to plain text mode 
    Last edited by d_stranz; 9th April 2021 at 23:40. Reason: missing [code] tags

Similar Threads

  1. QAxWidget embed excel into QDialog
    By cia.michele in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2013, 16:37
  2. how to embed excelin qt window
    By honey25 in forum Newbie
    Replies: 0
    Last Post: 14th September 2012, 11:37
  3. Replies: 10
    Last Post: 11th June 2012, 09:16
  4. Hiding ToolBars/Docks From Main window
    By ComaWhite in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2010, 04:32
  5. Embed QWebView into non-QT Win32 window (whole window)
    By sonusingh in forum Qt Programming
    Replies: 0
    Last Post: 29th January 2010, 11:40


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.