在VC6中使用水晶报表8.5

本文介绍如何使用COM技术创建实例、打开报表、设置显示工具栏和标签、隐藏特定字段,并通过刷新视图更新报表内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值