| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 6 | |
This is my first experience using COM objects within a Qt project, so I might be doing something wrong, so I would appreciate any pointers. I'm using the ActiveQt classes to automate MS Excel from my app. Everything is working correctly, it's just excruciatingly slow. I'm running this on a P4 2.4G machine with plenty of memory, btw. Here is a sample of some of the code: QValueList <QVariant> load; QAxObject *Excel = new QAxObject( "Excel.Application", this ); QAxObject *ExcelApp = Excel->querySubObject( "Application()" ); QAxObject *ExcelWorkbooks = Excel->querySubObject( "Workbooks()" ); QAxObject *ExcelWB = ExcelWorkbooks->querySubObject( "Add()" ); QAxObject *ExcelWS = ExcelWB->querySubObject( "Worksheets( int )", 1 ); // Display Excel ExcelApp->setProperty( "Visible", true ); // First, send the header load << "Group:" << group->name() << "" << "Head:" << 2000; ExcelCell = ExcelWS->querySubObject( "Range( QString )", "A1:E1" ); ExcelCell->setProperty( "Value", load ); load.clear(); ====== Very simple code, it works as expected: Creates the Excel object, a new workbook, puts data in 5 cells. The problem is that it takes approx 15 seconds for this code to run. Every querySubObject call seems to take a very long time. My question: is this normal, or is there something I should be doing to speed this up?
> I'm using the ActiveQt classes to automate MS Excel from my app.
> Everything is working correctly, it's just excruciatingly slow. I'm
> running this on a P4 2.4G machine with plenty of memory, btw.
I don't have a solution for the slowness, but I have also seen this behaviour. In the end I used another mechanism to talk to Excel without using the ActiveQt classes. Use the #imports below to generate header and implementation files that do the communication for you. It's a bit ugly and there's no comments, but I managed to get it going. The link below is where I found this info.
I'm sure there's a better way to do this, and I think visual studio can also generate better wrapper classes than this method below, so you might want to look in that direction first. That said, I'd also like to hear if anyone has used ActiveQt without the slowness.
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20642013.html
// imports for the Excel COM stuff.
#import "C:\Program Files\Microsoft Office\Office\MSO9.DLL"
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files\Microsoft Office\Office\EXCEL9.OLB" \
rename("DialogBox", "ExcelDialogBox") \
rename("RGB", "ExcelRGB") \
no_dual_interfaces
Cheers,
Craig.
Hi > That said, I'd also like to hear if anyone has > used ActiveQt without the slowness. Trolltech do know about this problem. I have been told that it is being addressed for Qt4. But, in the meantime, I do suggest you use a different mechanism. HTH Paul