const CLSID CLSID_Application = {0xb4741fd0,0x45a6,0x11d1,{0xab,0xec,0x00,0xa0,0xc9,0x27,0x4b,0x91}};
const IID IID_IApplication = {0x0bac5cf2,0x44c9,0x11d1,{0xab,0xec,0x00,0xa0,0xc9,0x27,0x4b,0x91}};
const CLSID CLSID_ReportObjects = {0xb4741e60,0x45a6,0x11d1,{0xab,0xec,0x00,0xa0,0xc9,0x27,0x4b,0x91}};
const IID IID_IReportObjects = {0x0bac59b2,0x44c9,0x11d1,{0xab,0xec,0x00,0xa0,0xc9,0x27,0x4b,0x91}};
初始化:
HRESULT hr = CoCreateInstance(CLSID_Application, NULL, CLSCTX_INPROC_SERVER , IID_IApplication, (void **) &m_Application);
m_Report=m_Application->OpenReport("resume.rpt");
m_wndCRViewer.SetReportSource(m_Report);
m_wndCRViewer.SetDisplayToolbar(false);
m_wndCRViewer.SetDisplayTabs(false);
m_wndCRViewer.SetDisplayGroupTree(false);
m_wndCRViewer.ViewReport();
m_wndCRViewer.Zoom(100);
隐藏字段:
VARIANT vtParam;
vtParam.vt=VT_I4;
vtParam.intVal=1;
if(m_bShowName)
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=false;
else
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=true;
vtParam.intVal=2;
if(m_bShowAddress)
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=false;
else
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=true;
vtParam.intVal=3;
if(m_bShowJob)
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=false;
else
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=true;
vtParam.intVal=4;
if(m_bShowLike)
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=false;
else
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=true;
vtParam.intVal=5;
if(m_bShowProp)
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=false;
else
m_Report->Areas->GetItem("D")->GetSections()->GetItem(vtParam)->Suppress=true;
m_wndCRViewer.Refresh();