S
S
Slavka2016-03-20 03:30:00
Qt
Slavka, 2016-03-20 03:30:00

Qt, Excel crashes when selecting a work page?

QAxObject* excel = new QAxObject( "Excel.Application", 0 );
    excel->dynamicCall("SetVisible(bool)",true);
    QAxObject *workbooks = excel->querySubObject( "Workbooks" );
    QAxObject *workbook = workbooks->querySubObject("Add()");

    QAxObject *sheets = workbook->querySubObject( "Worksheets" );
    QAxObject *sheet1 = sheets->querySubObject( "Item( int )", 1 );
    sheet1->dynamicCall("SetName(const QString&)", QVariant("Лист1"));

It crashes all the time with an error
QAxObject *sheets = workbook->querySubObject( "Worksheets" );

But break the whole Internet everyone does this and it works for them?
Qt 5.5 Excel 2013

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2016-03-20
@Slavka_online

This code works for me with Qt 5.6 and MS Excel 2013.
So you have some problems with the office.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question