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. Want to open an excel file .xlsm using resource .qrc
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.3k Views
  • 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.
  • N Offline
    N Offline
    nikit
    wrote on last edited by
    #1

    I have a qrc where I have an excel file to open.
    read function will just read excel file and display it on console.
    read(":/MyFile/resourcefile.pro");

    But, I want to open that excel file. I tried below code :
    p.start(":/excel/b1.xlsm");
    if (p.waitForStarted())
    {
    p.waitForFinished();
    qDebug() << p.readAllStandardOutput();
    }
    else
    qDebug() << "Failed to start";

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

    raven-worxR 1 Reply Last reply
    0
    • N nikit

      I have a qrc where I have an excel file to open.
      read function will just read excel file and display it on console.
      read(":/MyFile/resourcefile.pro");

      But, I want to open that excel file. I tried below code :
      p.start(":/excel/b1.xlsm");
      if (p.waitForStarted())
      {
      p.waitForFinished();
      qDebug() << p.readAllStandardOutput();
      }
      else
      qDebug() << "Failed to start";

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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @nikit
      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.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nikit
        wrote on last edited by
        #3

        Thank you for the reply.
        Yes its QProcess. Will it won't open a batch file also? Like
        QProcess p;
        p.start("/res/html/excel/run.bat");

        raven-worxR 1 Reply Last reply
        0
        • N nikit

          Thank you for the reply.
          Yes its QProcess. Will it won't open a batch file also? Like
          QProcess p;
          p.start("/res/html/excel/run.bat");

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #4

          @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.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          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