Results 1 to 1 of 1

Thread: Updating Pivot Tables in Exel

  1. #1
    Join Date
    Nov 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Updating Pivot Tables in Exel

    Solved the problem myself... in case anybody needs to know:
    Qt Code:
    1. QAxObject* excel = new QAxObject( "Excel.Application", 0 );
    2.  
    3. //open file
    4. QAxObject *workbooks = excel->querySubObject( "Workbooks" );
    5. QAxObject *workbook = workbooks->querySubObject( "Open(const QString&)", "test.xlsm" );
    6.  
    7. // write data
    8. QAxObject * range = worksheet->querySubObject("Range(C10)");
    9. range->setProperty("Value", QVariant(7));//DATA TO BE WRITTEN=7
    10.  
    11. // update the whole workbook
    12. workbook->dynamicCall("RefreshAll()");
    13.  
    14. // read data
    15. qDebug() << "Alter Wert: " << range->property("Value").toInt();
    16.  
    17. //close excel (silently)
    18. workbook->dynamicCall("Close (Boolean)", false);
    19. excel->dynamicCall( "Quit()");
    To copy to clipboard, switch view to plain text mode 
    Last edited by tklemmer; 4th April 2012 at 12:58.

Similar Threads

  1. import data from exel to tableview
    By daly001 in forum Newbie
    Replies: 3
    Last Post: 2nd January 2012, 23:21
  2. Replies: 0
    Last Post: 18th April 2011, 02:21
  3. Replies: 4
    Last Post: 13th July 2010, 05:17
  4. Replies: 1
    Last Post: 16th May 2010, 19:25

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.