Unsolved QFile open Excel file
-
Hello people. How are you?
A question. It's possible to open a microsoft exel's file with QFile?
QString nombre; nombre=ui->lineEdit->text(); file= new QFile(nombre); if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) { QMessageBox msg; msg.setText("The file is not open"); msg.exec(); qDebug()<<"the problem is :"<<file->error()<<endl; }
And the return of qDebug() is 5. By the way the QString is the exel'name.
-
Hi Julian,
You will need the ActiveQt framework for that.
Here is a good starting point : Using_ActiveX_Object_in_Qt
Happy coding!
-
@Julian It is possible to open any file with QFile as long as your process has needed access rights. Use http://doc.qt.io/qt-5/qiodevice.html#errorString to get error text.
But if you want to handle Excel documents then you will need to do what @Eddy suggested. -
-
I want my program to open MS Excel and load the file:
QDesktopServices::openUrl(QUrl::fromUserInput(ui->lineEdit->text()));
-
I want to read/write an excel file with my application and I have MS Excel installed on my machine: https://forum.qt.io/topic/80167/qfile-and-fle-s-tipes/3
-
I want to read an excel file and I don't have MS Excel:
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC"); db.setDatabaseName("DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + ui->lineEdit->text());
- I want to read/write an excel file and I don't have MS Excel: https://github.com/VSRonin/QtXlsxWriter
For more info: https://wiki.qt.io/Handling_Microsoft_Excel_file_format
-