Are you sure those objects have properties Enabled and Visible?
luoyes (6th January 2011)
Thanks for you attention.
Yes, I'm sure, I found it in the MSDN.
I think the problem is there is no room to show these commandbars.There must be some pannel or something else should be turned on, or use QAxWidget::setControl() with a file name is not a good way.
What does generateDocumentation() for each of the subobjects return?
luoyes (7th January 2011)
Returns nothing.
Here is all the code.
Qt Code:
setLayout( playout ); playout->addWidget( m_pAxWidget ); playout->setMargin( 0 ); m_pAxWidget->setControl( qsFileName ); QAxObject *pStandard = m_pAxWidget->querySubObject( "CommandBars( const QVariant & )", "Standard" ); pStandard->dynamicCall( "Enabled", true ); pStandard->dynamicCall( "Visible", true ); QAxObject *pFormatting = m_pAxWidget->querySubObject( "CommandBars( const QVariant & )", "Formatting" ); pFormatting->dynamicCall( "Enabled", true ); pFormatting->dynamicCall( "Visible", true ); qDebug() << pStandard->generateDocumentation(); qDebug() << pFormatting->generateDocumentation();To copy to clipboard, switch view to plain text mode
Ok, also check pStandard->isNull() and pFormatting->isNull(). I have a feeling your sub object calls are invalid. Also try dumping QAxBase::propertyBag() for those subobjects if they are not null. You can dump the properties for your m_pAxWidget object too.
Thanks for your patience
I checked pStandard->isNull() and pFormatting->isNull(). They returned false.
And the properties are right. Both Visible and Enabled are true.
So I think the problem is there is no space to show them. I tried to get CommandBar's parent and make it visible, but that made the word application visible out of my widget.
So maybe it is not very easy to show Word in QWidget with commandBars. It needs much more work to do.
Thanks again.
Did you find the solution already? I'm eagerously looking for the solution all the time these days. Could you please share your solution at your convenience ?
Cheers
Pei
Welcome to Vision Open
http://www.visionopen.com
I think the original poster's problem is that he was trying to create an embedded MS Word ActiveX object simply by trying to open a Word document. This is completely dependent on the ".doc" extension being assigned to Word documents in MS Windows. On my PC, I use Apache OpenOffice, and when I open a ".doc" file, it opens in OpenOffice, not MS Word.Did you find the solution already?
In order to get this to work correctly, you need to use the GUID for the MS Word COM object in the setControl() call, not the name of the file you want to open. Once you have the MS Word COM object instantiated, you can use it to open the document and display it.
There are plenty of examples on how to do this. I would start with this article It uses MS Excel, but MS Word is basically the same thing. The COM object model for MS Word can be found here.
Bookmarks