那位能提供一個c#2005自帶水晶報表的用法的例子.
我是一個c#2005的初學者,最好能說具體點,有源代碼的例子最好.

解决方案 »

  1.   

    沒找到啊. 具體path 是什麼?
      

  2.   

    https://www.sdn.sap.com/irj/boc/businessobjects-samples?rid=/webcontent/uuid/80774579-b086-2b10-db91-ed58c4dda375
      

  3.   

    C:\Program Files\Microsoft Visual Studio 8\Crystal Reports\Samples
      

  4.   

    請問,我在c#2005(winform)中加了一個 Crystal Reports , 
    payReport pay_Report = new payReport() 
    實例化後怎麼顯示這個實例呢? pay_Report好像沒有.show ?
      

  5.   

    初学的话,建议你使用.net自带的.rdlc报表
    功能和水晶报表类似。
    水晶报表要注册。
    给你一个我写的代码:        //报表
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetReport_数据集", DataTable));
            ReportViewer1.LocalReport.ReportPath = "Report/报表(带路径).rdlc";
            ReportViewer1.LocalReport.ReportEmbeddedResource = "报表.rdlc";
           //参数
            ReportParameter rpStartDate = new ReportParameter("StartDate", StartDate.ToShortDateString());
            ReportParameter rpEndDate = new ReportParameter("EndDate", EndDate.ToShortDateString());
            ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rpStartDate, rpEndDate });
            ReportViewer1.DataBind();
            ReportViewer1.LocalReport.Refresh();
      

  6.   

    首先 ReportDocument report = new ReportDocument(); // 定义报表文档对象
    再 report.Load(Application.StartupPath + "\\Report\\" + _reportName + ".rpt"); //load报表文件
    report.SetDataSource(yourDataSet);
    report.SetParameterValue("parameterName", "parameterValue");//设置报表变量
    再用CrystalReportViewer这个控件
    crystalReportViewer1.ReportSource = report;
    crystalReportViewer1.Zoom(1);
    crystalReportViewer1.Show();
      

  7.   

    很久没有弄过水晶报表了,以前弄的。using System;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    using System.Data.SqlClient;
    using System.Data;
    using System.Collections;
    using System.Windows.Forms;
    using System.IO;namespace test_dx
    {
    /// <summary>
    /// report 的摘要说明。
    /// </summary>
    public class report
    {
    private ReportDocument rdc;
    private DiskFileDestinationOptions disk;
    private ExportOptions ex;
    public report()
    {
    disk = new DiskFileDestinationOptions();
    ex = new ExportOptions();
    //
    // TODO: 在此处添加构造函数逻辑
    //
    } #region//得到各种格式水晶报表,参数:数据集、导出文件格式、保存导出文件的完整路径。
    public void getCrystal(DataSet ds,string type,string path) //参数:数据集、导出文件格式、导出文件的完整路径。
    {
    try
    {
    //set ReportDocument;
    rdc = new ReportDocument();
    rdc.Load(Application.StartupPath + @"\Report1.rpt" );
    rdc.SetDataSource(ds);

    //set path;
    disk.DiskFileName = @path;
    ex = rdc.ExportOptions;
    ex.DestinationOptions = disk;
    ex.ExportDestinationType = ExportDestinationType.DiskFile; //Export the report
    switch (type)
    {
    case "pdf":
    ex.ExportFormatType = ExportFormatType.PortableDocFormat;
    break;
    case "doc":
    ex.ExportFormatType = ExportFormatType.WordForWindows;
    break;
    case "xls":
    ex.ExportFormatType = ExportFormatType.Excel;
    break;
    case "txt":
    ex.ExportFormatType = ExportFormatType.Text;
    break;
    default:
    this.writeLog("Export type error!");
    break;
    }


    rdc.Export();
    }
    catch(Exception ex)
    {
    this.writeLog(ex.ToString());
    }

    }
    #endregion #region//得到报表ReportDocument,参数:数据集、水晶报表框架路径。
    public ReportDocument getPDF(DataSet ds,string reportPath)
    {
    try
    {
    rdc = new ReportDocument();
    rdc.Load(reportPath);
    rdc.SetDataSource(ds);
    }
    catch(Exception ex)
    {
    this.writeLog(ex.ToString());
    }
    return rdc;
    }
    #endregion #region//写日志
    private void writeLog(string ex) //报表日志
    {
    try
    {
    string path = Application.StartupPath + @"\log\pdflog.txt";
    string time = DateTime.Now.ToString();
    StreamWriter sw = new StreamWriter(path,true,System.Text.Encoding.UTF8);
    sw.WriteLine(time);
    sw.WriteLine(ex);
    sw.WriteLine(" ");
    sw.Flush();
    sw.Close();
    }
    catch(Exception ss)
    {
    this.writeLog(ss.ToString());
    }
    finally
    {
    MessageBox.Show("Report log test ok!","TEST");
    }
      
    }
    #endregion
    }
    }
      

  8.   

    demo有点大,不好贴,就贴了这个水晶报表操作的核心部分。如果要看看的话:http://download.csdn.net/source/678709
      

  9.   

    【原创+分享】VS2005水晶报表PUSH模式(DataSet)视频教程+源代码工程示例 [推荐] 
    http://topic.csdn.net/u/20081118/10/49a1751d-1d86-44e4-969f-a847c2316dd3.html0基础,看完就会了。