📄 skinview.cpp
字号:
pReport1->SetNumberRC(5, 5, pDoc->sca);
pReport1->SetNumberRC(6, 5, pDoc->s2b);
pReport1->SetNumberRC(7, 5, pDoc->sws);
pReport1->SetNumberRC(8, 5, pDoc->svq);
pReport1->SetNumberRC(8, 5, pDoc->sym);
//损害深度
pReport1->SetNumberRC(10, 3, pDoc->fls);
//增产率
CString str;
str.Format("完全消除各种表皮系数后增产率为: %8.4lf", pDoc->dpr0);
pReport1->SetTextRC(13, 3, str);
//结论
if( pDoc->sd >= 5 || pDoc->dpr0 >= 1)
pReport1->SetTextRC(14, 3, "严重损害");
else if((pDoc->sd < 5 && pDoc->sd >= 1) || ( pDoc->dpr0 < 1 && pDoc->dpr0 >= 0.2))
pReport1->SetTextRC(14, 3, "中等损害");
else if((pDoc->sd < 2 && pDoc->sd >= 0) || ( pDoc->dpr0 < 0.2 && pDoc->dpr0 >= 0.0))
pReport1->SetTextRC(14, 3, "轻微损害");
else
pReport1->SetTextRC(14, 3, "无损害");
}
void CMyView::OnFileExporttoword()
{
// TODO: Add your command handler code here
CMyDoc* pDoc = GetDocument();
BeginWaitCursor();
if( pDoc->OPER != ZENGCHAN )
{
pDoc->OPER = ZENGCHAN;
SendMessage(WM_PAINT);
pChart->ShowWindow(SW_SHOW);
}
CRect graphsize;
pChart->GetWindowRect(graphsize);
if(graphsize.Width()>500 && graphsize.Height()>300)
{
pChart->MoveWindow(110, 0, 500, 300, FALSE);
}
pChart->Refresh();
// pChart->CopyBitmap();
CRect mapSize;
pChart->GetClientRect(mapSize);
CDC *dc, memDC;
CBitmap myMap;
dc = this->GetDC();
memDC.CreateCompatibleDC(dc);
myMap.CreateCompatibleBitmap(dc, mapSize.Width(), mapSize.Height());
CBitmap *poldMap = memDC.SelectObject(&myMap);
CPen *oldPen = (CPen *) memDC.SelectStockObject(WHITE_PEN);
memDC.Rectangle(0, 0, 500, 300);
memDC.SelectObject(oldPen);
pChart->Paint((long) memDC.m_hDC, 0, 0, mapSize.Width(), mapSize.Height(), TRUE, 0);
OpenClipboard();
EmptyClipboard();
SetClipboardData(CF_BITMAP, myMap.GetSafeHandle());
CloseClipboard();
memDC.SelectObject(poldMap);
myMap.Detach();
ReleaseDC(dc);
if(!msword.CreateDispatch("Word.Application", NULL))
{
AfxMessageBox("创建Word服务失败!");
exit(1);
}
msword.SetVisible(TRUE);
char ModuleName[256];
GetModuleFileName(NULL, ModuleName, 255);
int pos;
CString Name=ModuleName;
pos=Name.ReverseFind('\\');
ReportName = Name.Left(pos+1)+"report.dot";
ReportName = "\""+ReportName+"\"";
// ReportName.Replace("\\", "\\\\");
sprintf(ModuleName, "%s", ReportName);
msdocu.AttachDispatch( msword.GetDocuments(), TRUE);
msdocu.Add(&_variant_t(ModuleName), &vtMissing);
msselection.AttachDispatch(msword.GetSelection(), TRUE);
char buf[250];
// 井名
msselection.GoTo(&COleVariant(3L), &vtMissing, &COleVariant(1L), &COleVariant("") );
sprintf(buf, "%s", pDoc->Wellname);
msselection.TypeText(buf);
// 第一个表格, 地层参数
msselection.GoTo(&COleVariant((long)2), &vtMissing, &vtMissing, &COleVariant("") );
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)1), &vtMissing);
sprintf(buf, "%6.2f", pDoc->ca); // 地层形状系数
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->phi); // 孔隙度
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
if(pDoc->n1b) // 无边界时不显示边界值
{
sprintf(buf, "%6.2f", pDoc->dwtob1); // 第一条边界
msselection.TypeText(buf);
}
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
if(pDoc->n2b) // 无边界时不显示边界值
{
sprintf(buf, "%6.2f", pDoc->dwtob2); // 第一条边界
msselection.TypeText(buf);
}
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.4f", pDoc->hkx); // X方向渗透率
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.4f", pDoc->hky); // Y方向渗透率
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.4f", pDoc->vk); // Z方向渗透率
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.4f", pDoc->hkout); // 外圈渗透率
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->h); // 地层厚度
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->hp); // 部分打开地层厚度
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%8.6f", pDoc->ct); // 综合压缩系数
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%8.6f", pDoc->alf); // 储层压力敏感系数
msselection.TypeText(buf);
// msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
// 第二个表格 生产参数
msselection.GoTo(&COleVariant((long)2), &vtMissing, &vtMissing, &COleVariant("") );
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)1), &vtMissing);
sprintf(buf, "%6.2f", pDoc->tp); // 生产时间
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->qc); // 定产量
if(pDoc->nvq == 0)
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->pi); // 静压
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->pwf); // 流压
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.4f", pDoc->hnslop); // 霍纳斜率
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
// 第三个表格 井深参数
msselection.GoTo(&COleVariant((long)2), &vtMissing, &vtMissing, &COleVariant("") );
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)1), &vtMissing);
sprintf(buf, "%6.2f", pDoc->wsl); // 井斜角
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->s); // 表皮系数
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->rw); // 井筒半径
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->rb); // 两相区半径
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->rkfpc); // 渗透率比值
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
// 第四个表格 流体参数
msselection.GoTo(&COleVariant((long)2), &vtMissing, &vtMissing, &COleVariant("") );
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)1), &vtMissing);
sprintf(buf, "%6.2f", pDoc->rhls); // 密度
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->vis); // 粘度
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->bfv); // 体积系数
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2g", pDoc->belt); // 紊流系数
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.4f", pDoc->d); // 非达西流系数
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
// 第五个表格 射孔参数
msselection.GoTo(&COleVariant((long)2), &vtMissing, &vtMissing, &COleVariant("") );
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)1), &vtMissing);
sprintf(buf, "%6.0f", pDoc->n); //
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->lphi); //
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->flp); //
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->rp); //
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
sprintf(buf, "%6.2f", pDoc->gk); //
msselection.TypeText(buf);
msselection.MoveRight(&COleVariant((long)12), &COleVariant((long)2), &vtMissing);
// 产量
msselection.GoTo(&COleVariant(3L), &COleVariant(1L), &COleVariant(34L), &COleVariant("") );
for(int i=1; i<=pDoc->nq; i++)
{
sprintf(buf, "%10.2f%20s%10.2f", pDoc->t[i], " ", pDoc->q[i]);
msselection.TypeText(buf);
}
// 评价结果
msselection.GoTo(&COleVariant(-1L), &vtMissing, &vtMissing, &COleVariant("result"));
sprintf(buf, "1. 总表皮系数 = %-10.4lf\n", pDoc->s);
msselection.TypeText(buf);
sprintf(buf, "2. 分解表皮系数\n");
msselection.TypeText(buf);
sprintf(buf, " 部分打开表皮系数 = %-10.4lf, 射孔表皮系数 = %-10.4lf\n",
pDoc->spt, pDoc->spf);
msselection.TypeText(buf);
sprintf(buf, " 非达西流表皮系数 = %-10.4lf, 地层边界形状表皮系数 = %-10.4lf\n",
pDoc->snd,pDoc->sca);
msselection.TypeText(buf);
sprintf(buf, " 一条边界表皮系数 = %-10.4lf, 两条边界表皮系数 = %-10.4lf\n",
pDoc->s1b, pDoc->s2b);
msselection.TypeText(buf);
sprintf(buf, " 相变表皮系数 = %-10.4lf, 井斜表皮系数 = %-10.4lf\n",
pDoc->scp, pDoc->sws);
msselection.TypeText(buf);
sprintf(buf, " 各向异性表皮系数 = %-10.4lf, 变产量表皮系数 = %-10.4lf\n",
pDoc->san, pDoc->svq);
msselection.TypeText(buf);
sprintf(buf, " 地层损害表皮系数 = %10.4lf, 压力敏感表皮系数 = %-10.4lf\n",
pDoc->sd, pDoc->sym);
msselection.TypeText(buf);
sprintf(buf, "3. 地层损害深度 = %10.4lfm\n", pDoc->fls);
msselection.TypeText(buf);
sprintf(buf, "4. 完全消除地层损害表皮系数后增产率为 = %-7.3lf\n",pDoc->dpr0);
msselection.TypeText(buf);
if( pDoc->sd >= 10 || pDoc->dpr0 >= 1)
sprintf(buf, "5. 结论:该层受到严重损害,建议实行大型增产措施");
else if((pDoc->sd < 5 && pDoc->sd >= 1) || ( pDoc->dpr0 < 1 && pDoc->dpr0 >= 0.2))
sprintf(buf, "5. 结论:该层受到较严重损害,建议实行增产措施");
else if((pDoc->sd < 2 && pDoc->sd >= 0) || ( pDoc->dpr0 < 0.2 && pDoc->dpr0 >= 0.0))
sprintf(buf, "5. 结论:轻微损害");
else
sprintf(buf, "5. 结论:无损害");
msselection.TypeText(buf);
// 插入图形
msselection.GoTo(&COleVariant(-1L), &vtMissing, &vtMissing, &COleVariant("graph"));
msselection.Paste();
// 返回文件开头
msselection.GoTo(&COleVariant(3L), &vtMissing, &COleVariant(1L), &COleVariant("") );
EndWaitCursor();
}
void CMyView::OnUpdateFileExporttoword(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
CMyDoc* pDoc = GetDocument();
pCmdUI->Enable(pDoc->OPER);
}
void CMyView::OnUpdateFilePrintReport(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
CMyDoc* pDoc = GetDocument();
pCmdUI->Enable(pDoc->OPER);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -