Results 1 to 3 of 3

Thread: Read excel

  1. #1
    Join Date
    Aug 2007
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Read excel

    Sorry for my bad english.

    I need to read the information in a excel and then show it in a little screem (with the QMessageBox for example).
    If it's posible, can you give me an example?
    I found this here but I don't know how to read the information of a line and a certain column.
    Thank you.

    Qt Code:
    1. //Create connection, add workbook und sheet
    2. QAxObject* excel = new QAxObject("Excel.Application", 0);
    3. QAxObject* app = excel->querySubObject("Application()");
    4. QAxObject* wbks = excel->querySubObject("Workbooks()");
    5. QAxObject* wb = wbks->querySubObject("Add()");
    6. QAxObject* ws = wb->querySubObject("Worksheets(int)", 1 );
    7. //Show Excel
    8. app->setProperty("Visible", true );
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 23rd December 2008 at 21:44. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Read excel

    Quote Originally Posted by psipsi View Post
    I found this here but I don't know how to read the information of a line and a certain column.
    Try:
    Qt Code:
    1. QAxObject * ws = wb->querySubObject( "Worksheets(int)", 1 );
    2. QAxObject *range = ws->querySubObject( "Cells(int,int)", 1, 1 );
    3.  
    4. QString value = range->dynamicCall( "Value" ).toString();
    5. // or
    6. QString value = range->property( "Value" ).toString();
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to jacek for this useful post:

    psipsi (3rd August 2007)

  4. #3
    Join Date
    Oct 2007
    Posts
    5
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Read excel

    Just a very dumb question (no experience with ActiveX yet):
    how to open an existing excel file in your demo code above?

Similar Threads

  1. How can I Read Write Excel File
    By xingshaoyong in forum Qt Programming
    Replies: 6
    Last Post: 13th July 2011, 20:16
  2. Read \Write Excel File using Qt
    By xingshaoyong in forum Qt Programming
    Replies: 4
    Last Post: 27th July 2007, 22:07
  3. How to read Raw Information from CD in MAC?
    By vishal.chauhan in forum General Programming
    Replies: 0
    Last Post: 10th July 2007, 12:26
  4. How to read CD with read?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 29th June 2007, 08:20
  5. QIODevice read()
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 00:29

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.