Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] ActiveQT, Cannot Open properly a protected xls or xlsx file
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Radox
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Radox
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved