Want to open an excel file .xlsm using resource .qrc

  • I have a qrc where I have an excel file to open.
    read function will just read excel file and display it on console.

    But, I want to open that excel file. I tried below code :
    if (p.waitForStarted())
    qDebug() << p.readAllStandardOutput();
    qDebug() << "Failed to start";

    And I get "Failed to start".
    Any idea why can't i open the file using qrc.?

  • Moderators

    I assume p is of type QProcess?
    That won't work, since the process then would need to access binary data in your application memory.
    You should write the contents to a temporary file (e.g. use QTemporaryFile) or don't put it into your application's qrc in the first place.

  • Thank you for the reply.
    Yes its QProcess. Will it won't open a batch file also? Like
    QProcess p;

  • Moderators

    @nikit said
    only from a path the launched process also has access to.
    qrc are in the caller application memory scope, so no access for another application. Easiest is you go the way over the filesystem.

Log in to reply