最近項目用到使用本地的office打開指定的文件,記錄一下代碼:
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "/", tr("All Files (*.*)")); QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(fileName).absoluteFilePath()));
不僅可以打開office,貌似能本地打開的都行。
最近項目用到使用本地的office打開指定的文件,記錄一下代碼:
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "/", tr("All Files (*.*)")); QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(fileName).absoluteFilePath()));
不僅可以打開office,貌似能本地打開的都行。
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。