m_Application.CreateInstance (__uuidof(Application));
_bstr_t strRptName = "E://Cristal//MultDetailsExamp//DataAndPic.rpt";
_bstr_t strPicName = "E://Cristal//MultDetailsExamp//AreaStudytemp.bmp";
//不知道为什么,如果在打开报表之前,对新修改的图片不进行大小调整的话,就会弹出对话框,说链接不正确之类的,不知道为什么,期待解决
HINSTANCE hInt=ShellExecute(this->m_hWnd,"open","kodakimg.exe",strPicName,"", SW_SHOW );
m_Report =m_Application->OpenReport((_bstr_t)strRptName);
//修改报表中已经存在的图片OLE链接
pChartObj = NULL;
pSections = NULL;
pSection = NULL;
pCROleObj = NULL;
_variant_t var;
VariantInit(&var);
var.vt = VT_I2;
var.iVal = 1;
_bstr_t bstr;
long lg;
pSection = m_Report->GetAreas()->GetItem("RH")->GetSections()->GetItem(var);
bstr = pSection->GetCssClass();
bstr = pSection->GetName();
pReportObj = pSection->ReportObjects->GetItem("Pic1");
if (pReportObj->Kind == crOleObject)
{
pCROleObj = pReportObj;
}
pReportObj->Name = "水晶报表测试图例2";
//。。。。。。。。。。。
本文介绍了一个使用水晶报表(Crystal Reports)过程中遇到的问题及解决方案,主要讨论如何在报表中更新已存在的图片OLE链接,涉及创建应用程序实例、打开报表、定位并修改特定区域内的图片等步骤。
3149

被折叠的 条评论
为什么被折叠?



