在vs2005环境中,设计rpt文件时,选择字段,点击“设计对象格式”->段落->文本解释,有三个选项:无、rtf文本、html文本,我选了html。在预览时显示正确,显示红色的“Hello World!”;在运行时,却显示为“FONT color=red>Hello World! </FONT>”。 
我以为是crystal report的bug,请教各位:这是怎么回事?

解决方案 »

  1.   

    楼主看一下原代码。FONT color=red>这里好相少了一个“<”
    它不认为这是一个标记,所以就显示出来了
      

  2.   

    我发帖时,漏了一个“<”,应该是:在运行时,却显示为“<FONT color=red>Hello World!  </FONT>”。  
      

  3.   

    拉模式:
    // CrystalReport.rpt是水晶报表文件的名称;CrystalReportSource1是从工具箱加到页面上的水晶报表数据源对像。
       CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport.rpt"));
    // SetDatabaseLogon 拉模式中必须用这个方法来设置登录信息,参数一:用户名;参数二:密码;参数三:服务器;参数四:数据库名
      CrystalReportSource1.ReportDocument.SetDatabaseLogon("sa", "123456", @"SYWZSWL\SQLEXPRESS", "Test");
    //给水晶报表传参数,参数一:是参数名,参数二:参数值;
      CrystalReportSource1.ReportDocument.SetParameterValue("Title", "这是一个测试报表");
      CrystalReportSource1.ReportDocument.SetParameterValue("Parm", "1");
    //绑定水晶报表数据源。
      CrystalReportSource1.DataBind();
    // CrystalReportViewer1是水晶报表浏览器,下面是给该浏览器赋上对像
      CrystalReportViewer1.ReportSource = CrystalReportSource1;
      CrystalReportViewer1.DataBind();
      

  4.   

    http://vbcity.com/forums/t/104797.aspx
    成功解决,使用数据集作为报表的数据源。