I am trying to open a pdf and a excel file on button click.
Qt Code:
  1. connect(ui->button1,SIGNAL(clicked()),this,SLOT(OpenPdfFile()));
  2. void MainWindow::OpenPdfFile()
  3. {
  4. QDesktopServices::openUrl(QUrl("GMHeaderCheckTool_UserManual.pdf", QUrl::TolerantMode));//working perfectly
  5.  
  6. }
  7. connect(ui->button2,SIGNAL(clicked()),this,SLOT(OpenExcelFile()));
  8. void MainWindow::OpenExcelFile()
  9. {
  10. // where ExcelFileName conatin the Path of the excel location
  11. QString ExcelFileName = "d:/Tools/HeadercheckTool/Requirment/To Anil/To Anil/Tool.xlsx"
  12. QDesktopServices::openUrl(QUrl(ExcelFileName, QUrl::TolerantMode));//Not working
  13. }
To copy to clipboard, switch view to plain text mode 
When I am trying to open the Excel file I am getting the below error
d:/Tools/HeadercheckTool/Requirment/To Anil/To Anil/Tool.xlsx' failed (error 2)
Please let me know how can i open excel file?