[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: http://msdn.microsoft.com/en-us/library/ff194819(v=office.14).aspx

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

    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:
    QString("password")
    "password"
    password

    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,password)
    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;
    params<<"C:\filename.xls"<<0<<false<<2<<"password";
    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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.