|
@@ -110,7 +110,55 @@ void ExportReportManager::insertCommonInfo()
|
|
|
insertText("bmEvalPurpose", m_proj->estimateObjective);
|
|
|
}
|
|
|
|
|
|
-void ExportReportManager::insertSchemeInfo() { }
|
|
|
+void ExportReportManager::insertSchemeInfo()
|
|
|
+{
|
|
|
+ QList<SchemaEval *> schemeList;
|
|
|
+ bool ret = SchemeInfoService().QuerySchemeInfoByEngineerId(&schemeList, m_proj->id, 0);
|
|
|
+ if (ret == false) {
|
|
|
+ qDebug() << __FUNCTION__ << __LINE__ << "query" << endl;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = schemeList.size() - 1; i >= 0; --i) {
|
|
|
+ // 插入图片
|
|
|
+ QAxObject *bmSchemes = m_word->getDocument()->querySubObject("Bookmarks(QVariant)", "bmSchemes");
|
|
|
+ if (bmSchemes != nullptr) {
|
|
|
+ bmSchemes->dynamicCall("Select(void)");
|
|
|
+ QAxObject *range = bmSchemes->querySubObject("Range");
|
|
|
+ QAxObject *inlineShapes = range->querySubObject("InlineShapes");
|
|
|
+ QAxObject *shape = inlineShapes->querySubObject("AddPicture(const QString&)", schemeList[i]->filePath);
|
|
|
+ if (shape != nullptr) {
|
|
|
+ shape->setProperty("Width", 200);
|
|
|
+ shape->setProperty("Height", 200);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ m_word->insertMoveDown();
|
|
|
+
|
|
|
+ // 插入图片标题
|
|
|
+
|
|
|
+ QString remark = schemeList[i]->remark;
|
|
|
+ int picTtlIndex = remark.lastIndexOf("(图");
|
|
|
+ QString subStr = remark.mid(picTtlIndex + 1, 8);
|
|
|
+ QString picTtl = "";
|
|
|
+ if (subStr.contains(")")) {
|
|
|
+ picTtl = subStr.split(")").first();
|
|
|
+ }
|
|
|
+
|
|
|
+ m_word->setFontName(QString::fromLocal8Bit("黑体"));
|
|
|
+ m_word->setFontSize(9);
|
|
|
+ m_word->setParagraphAlignment(0);
|
|
|
+ m_word->insertText(picTtl + " " + "阵地位置图");
|
|
|
+ m_word->insertMoveDown();
|
|
|
+
|
|
|
+ // 插入方案描述
|
|
|
+ insertText("bmSchemes", schemeList[i]->name + ":" + schemeList[i]->remark);
|
|
|
+
|
|
|
+ if (i != 0) {
|
|
|
+ m_word->insertMoveDown();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
bool ExportReportManager::insertText(const QString &bookmark, const QString &text)
|
|
|
{
|
|
@@ -119,7 +167,7 @@ bool ExportReportManager::insertText(const QString &bookmark, const QString &tex
|
|
|
QAxObject *bmProjName = doc->querySubObject("Bookmarks(QVariant)", bookmark);
|
|
|
|
|
|
if (bmProjName != nullptr) {
|
|
|
- bmProjName->dynamicCall("Select(void)"); //选中要选中的区域
|
|
|
+ bmProjName->dynamicCall("Select(void)");
|
|
|
QAxObject *range = bmProjName->querySubObject("Range");
|
|
|
ret = range->setProperty("Text", text);
|
|
|
}
|