Results 1 to 17 of 17

Thread: copy/move excel sheet with QT

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default copy/move excel sheet with QT

    Hi all


    I manipulate excel with qt an all is working almost well.

    Just one issue : I don't success to cpoy/move a sheet in the current workbook

    I have try :
    sheet->dynamicCall("Copy");
    sheet->dynamicCall("Move");

    but the result is a copy/move to a new workbook

    HOw can I solve this?

    Thanks



    Qt Code:
    1. QAxObject* sheet;
    2. QStringList sheets_name;
    3. QAxObject* workbooks;
    4. QAxObject* workbook;
    5. QAxObject*sheets;
    6.  
    7. QString campaign_sheet_name;
    8. QAxObject * excel_cell ;
    9. QAxWidget* excel;
    10.  
    11. qint16 xl_test_start_line = 16;
    12. qint16 sheet_number;
    13.  
    14. //Launch Excel
    15. if (ui->check_button_excel->isChecked())
    16. {
    17. excel = new QAxWidget("Excel.Application");
    18. workbooks = excel->querySubObject( "Workbooks" );
    19. workbook = workbooks->querySubObject( "Open(const QString&)",excel_path );
    20. sheets = workbook->querySubObject( "Worksheets" );
    21. if ( ui->radioButton_XLVisible->isChecked())
    22. excel->setProperty("Visible", true);
    23. int count = sheets->dynamicCall("Count()").toInt();
    24. count = sheets->property("Count").toInt();
    25.  
    26. //Get sheets name list
    27. for (int i = 1; i <= count; i++)
    28. {
    29. QAxObject * worksheet = workbook->querySubObject("Worksheets(int)", i);
    30. sheets_name.push_back(worksheet->property("Name").toString());
    31. number_of_test.push_back(0);
    32. }
    33. sheet = sheets->querySubObject( "Item( int )", 5 );
    34. }
    35.  
    36. sheet->dynamicCall("Copy");
    To copy to clipboard, switch view to plain text mode 
    Last edited by gerardpuducul; 24th October 2012 at 09:18.

Similar Threads

  1. QSettings: copy from ini to xml? Copy group?
    By TorAn in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2012, 14:51
  2. Problem in Move Move Event Handler.
    By redgoof in forum Qt Programming
    Replies: 0
    Last Post: 7th April 2010, 11:45
  3. ActiveQt hosting Excel sheet
    By ArmanS in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2010, 10:27
  4. How to copy from Excel and paste to QTableView
    By sms in forum Qt Programming
    Replies: 5
    Last Post: 7th February 2009, 03:58
  5. Move Rectangle on mouse Move
    By vermarajeev in forum Qt Programming
    Replies: 24
    Last Post: 14th May 2007, 05:34

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
  •  
Qt is a trademark of The Qt Company.