|
|
@@ -77,7 +77,7 @@ void Reporting::fileSave(){
|
|
|
// 获取所有的工作文档
|
|
|
QAxObject * documents = word->querySubObject("Documents");
|
|
|
// 以文件testTemplate.dot为模版新建一个文档,注意这里的路径为绝对路径
|
|
|
- QDir dir(".");
|
|
|
+// QDir dir(".");
|
|
|
documents->dynamicCall("Add(QString)",templatePath);
|
|
|
// 获取当前激活的文档
|
|
|
QAxObject *document=word->querySubObject("ActiveDocument");
|
|
|
@@ -331,6 +331,7 @@ void Reporting::fileSave(){
|
|
|
document->dynamicCall("SaveAs (const QString&)", outFileName);
|
|
|
document->dynamicCall("Close (boolean)", true); //关闭文本窗口
|
|
|
word->dynamicCall("Quit(void)"); //退出word
|
|
|
+
|
|
|
QMessageBox::information(this, tr("消息"),tr("报告生成成功!"),QMessageBox::Ok);
|
|
|
// delete bookmark_text;
|
|
|
delete document;
|
|
|
@@ -352,7 +353,7 @@ void Reporting::on_zp1Button_clicked()
|
|
|
fileDialog->setFileMode(QFileDialog::ExistingFiles);
|
|
|
//设置视图模式
|
|
|
fileDialog->setViewMode(QFileDialog::Detail);
|
|
|
- ui->zp1Edit->setText(QString(fileDialog->getOpenFileName()));
|
|
|
+ ui->zp1Edit->setText(QString(QFileDialog::getOpenFileName(this, tr("Open File"), ".", tr("Images (*.png *.xpm *.jpg)"))));
|
|
|
}
|
|
|
|
|
|
void Reporting::on_zp2Button_clicked()
|
|
|
@@ -369,7 +370,7 @@ void Reporting::on_zp2Button_clicked()
|
|
|
fileDialog->setFileMode(QFileDialog::ExistingFiles);
|
|
|
//设置视图模式
|
|
|
fileDialog->setViewMode(QFileDialog::Detail);
|
|
|
- ui->zp2Edit->setText(QString(fileDialog->getOpenFileName()));
|
|
|
+ ui->zp2Edit->setText(QString(QFileDialog::getOpenFileName(this, tr("Open File"), ".", tr("Images (*.png *.xpm *.jpg)"))));
|
|
|
}
|
|
|
|
|
|
void Reporting::on_pushButton_3_clicked()
|
|
|
@@ -386,7 +387,7 @@ void Reporting::on_pushButton_3_clicked()
|
|
|
fileDialog->setFileMode(QFileDialog::ExistingFiles);
|
|
|
//设置视图模式
|
|
|
fileDialog->setViewMode(QFileDialog::Detail);
|
|
|
- ui->zp3Edit->setText(QString(fileDialog->getOpenFileName()));
|
|
|
+ ui->zp3Edit->setText(QString(QString(QFileDialog::getOpenFileName(this, tr("Open File"), ".", tr("Images (*.png *.xpm *.jpg)")))));
|
|
|
}
|
|
|
|
|
|
void Reporting::on_zp4Button_clicked()
|
|
|
@@ -403,7 +404,7 @@ void Reporting::on_zp4Button_clicked()
|
|
|
fileDialog->setFileMode(QFileDialog::ExistingFiles);
|
|
|
//设置视图模式
|
|
|
fileDialog->setViewMode(QFileDialog::Detail);
|
|
|
- ui->zp4Edit->setText(QString(fileDialog->getOpenFileName()));
|
|
|
+ ui->zp4Edit->setText(QString(QString(QFileDialog::getOpenFileName(this, tr("Open File"), ".", tr("Images (*.png *.xpm *.jpg)")))));
|
|
|
}
|
|
|
|
|
|
void Reporting::openAction()
|
|
|
@@ -420,5 +421,7 @@ void Reporting::openAction()
|
|
|
fileDialog->setFileMode(QFileDialog::ExistingFiles);
|
|
|
//设置视图模式
|
|
|
fileDialog->setViewMode(QFileDialog::Detail);
|
|
|
- templatePath=QString(fileDialog->getOpenFileName());
|
|
|
+ templatePath=QString(QString(QFileDialog::getOpenFileName(this, tr("Open File"), ".", tr("dot(*.dot)"))));
|
|
|
+ if(templatePath!=nullptr)
|
|
|
+ QMessageBox::information(this, tr("消息"),tr("模板加载成功!"),QMessageBox::Ok);
|
|
|
}
|