I am trying to open a pdf and a excel file on button click.
connect(ui->button1,SIGNAL(clicked()),this,SLOT(OpenPdfFile()));
void MainWindow::OpenPdfFile()
{
}
connect(ui->button2,SIGNAL(clicked()),this,SLOT(OpenExcelFile()));
void MainWindow::OpenExcelFile()
{
// where ExcelFileName conatin the Path of the excel location
QString ExcelFileName
= "d:/Tools/HeadercheckTool/Requirment/To Anil/To Anil/Tool.xlsx" }
connect(ui->button1,SIGNAL(clicked()),this,SLOT(OpenPdfFile()));
void MainWindow::OpenPdfFile()
{
QDesktopServices::openUrl(QUrl("GMHeaderCheckTool_UserManual.pdf", QUrl::TolerantMode));//working perfectly
}
connect(ui->button2,SIGNAL(clicked()),this,SLOT(OpenExcelFile()));
void MainWindow::OpenExcelFile()
{
// where ExcelFileName conatin the Path of the excel location
QString ExcelFileName = "d:/Tools/HeadercheckTool/Requirment/To Anil/To Anil/Tool.xlsx"
QDesktopServices::openUrl(QUrl(ExcelFileName, QUrl::TolerantMode));//Not working
}
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?
Bookmarks