.Net技术联盟

专注于.NET技术

导航

水晶报表序列号

Posted on 2006-09-07 08:42  一样的云  阅读(2872)  评论(1编辑  收藏  举报

License : AV860-01CS00G-U7000NC
SN : 1231467890

 

.net自带的注册

水晶报表注册码
注册号:6707437608
密码:AAP5GKS0000GDE100DS

用法1

 1ReportDoc  = new  ReportDocument();
 2            ReportDoc.Load(Server.MapPath("myReport.rpt"));
 3            解决登录错误问题
16            CrystalReportViewer1.ReportSource = ReportDoc;;
2
1    string strProvider = "Server=(local);DataBase=myDatabase;UID=sa;PWD=111";
2            SqlConnection MyConn = new SqlConnection(strProvider);
3            MyConn.Open();
4            string strSel = "Select * from SaleOfCuntry";
5            SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel,MyConn);
6            DataSet1 ds = new DataSet1();
7            MyAdapter.Fill(ds,"SaleOfCuntry");
8            ReportDoc.SetDataSource(ds);
9            Crv.ReportSource = ReportDoc;
导出
 1    CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new         CrystalDecisions.Shared.DiskFileDestinationOptions();
 2            ReportDoc.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
 3            switch (ddlFormat.SelectedItem.Text)
 4            {
 5                case "Rich Text (RTF)":
 6                         ReportDoc.ExportOptions.ExportFormatType =   CrystalDecisions.Shared.ExportFormatType.RichText;//
 7                         DiskOpts.DiskFileName = "c:\\Output.rtf";//
 8                    break;
 9                case "Portable Document (PDF)":
10                         ReportDoc.ExportOptions.ExportFormatType =   CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;//
11                         DiskOpts.DiskFileName = "c:\\Output.pdf";//
12                    break;
13                case "MS Word (DOC)":
14                         ReportDoc.ExportOptions.ExportFormatType =   CrystalDecisions.Shared.ExportFormatType.WordForWindows;//
15                         DiskOpts.DiskFileName = "c:\\Output.doc";//
16                    break;
17                case "MS Excel (XLS)":
18                         ReportDoc.ExportOptions.ExportFormatType =   CrystalDecisions.Shared.ExportFormatType.Excel;//
19                         DiskOpts.DiskFileName = "c:\\Output.xls";//
20                    break;
21                default:
22                    break;
23            }

24            ReportDoc.ExportOptions.DestinationOptions = DiskOpts;
25             ReportDoc.Export();
打印
 1    string strPrinterName; 
 2            strPrinterName = @"Canon Bubble-Jet BJC-210SP";
 3            // 设置打印页边距 
 4            PageMargins margins; 
 5            margins = ReportDoc.PrintOptions.PageMargins; 
 6            margins.bottomMargin = 250
 7            margins.leftMargin = 350
 8            margins.rightMargin = 350
 9            margins.topMargin = 450;     
10            ReportDoc.PrintOptions.ApplyPageMargins(margins);     
11            //应用打印机名称 
12            ReportDoc.PrintOptions.PrinterName = strPrinterName;     
13            // 打印    // 打印报表。将 startPageN 和 endPageN 
14            // 参数设置为 0 表示打印所有页。
15            ReportDoc.PrintToPrinter(1false,0,0);     
window用法
1OpenFileDialog dlg = new OpenFileDialog();
2            dlg.Title = "打开水晶报表文件";
3            dlg.Filter = "水晶报表文件(*.rpt)|*.rpt|所有文件|*.*";
4            if(dlg.ShowDialog()==DialogResult.OK)
5            {
6                crystalReportViewer1.ReportSource = dlg.FileName;
7            }