anh5kor
12th May 2016, 09:07
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()
{
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
}
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?
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
}
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?