Open excel file on buttonclick
I am trying to open a pdf and a excel file on button click.
Code:
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" }
When I am trying to open the Excel file I am getting the below error
Quote:
d:/Tools/HeadercheckTool/Requirment/To Anil/To Anil/Tool.xlsx' failed (error 2)
Please let me know how can i open excel file?
Re: Open excel file on buttonclick
Hi, try to add file:/// in front of the path. Maybe you also need to add " to your string because of the spaces in the path.
Best regards,
Ginsengelf
Re: Open excel file on buttonclick
Use QUrl::fromLocalFile().