Important: Please read the Qt Code of Conduct -

[Solved] ActiveQT, Cannot Open properly a protected xls or xlsx file

  • Hello everybody,
    I'm developing an application which requires to open xls and xlsx files protected by opening and/or writing password.
    I'm stuck since I cannot open files w/o showing the excel's pop-up password input messagebox.

    Open Method References:

    Actual Code:
    @ QAxObject* workbook = workbooks->querySubObject("Open(const QString&,missing,missing,missing,const QString&,missing,missing,missing,missing,missing,missing,missing,missing,missing,missing)",

    Tries so far (not posting the real code):
    1- Open(filename,null,password(5th arg),null)
    1a- null=NULL
    1b- null=QVariant()
    1c- null=QVariant("")
    1d- null=""
    1e- null=missing

    In any of these cases i tried with:

    Since I had no idea what was(is) going on, I tried also:
    2a- Adding gradually missing in password argument-1 position until the 15th argument, ex:
    Open(filename,missing,password) and so on
    2b- Fixxed password on the fifth and tried to input random data in other arguments

    3a- Open(const QString&, Password:password) //as written
    3b- Open(const QString&, Password:"password") //as written

  • Solved This Way (even if I'm unsatisfied):
    @QVariantList params;
    QAxObject * workbook =
    workbooks->querySubObject("Open(QString, QVariant, QVariant, QVariant, QVariant, QVariant)", params);@

    I solved this way because you can't skip optional parameters before the needed one, even if I thought that the =0 solution would work.

Log in to reply