zoukankan      html  css  js  c++  java
  • 水晶报表打印

    水晶报表打印问题:

    ReportDocument aReportDocument = new ReportDocument();

    //加载报表

     aReportDocument.Load(@Application.StartupPath + Properties.Settings.Default.MainReportPath);

    //子报表数据源

    aReportDocument.Subreports["SonRpt.rpt"].SetDataSource(sonDs);

    //传递参数

     aReportDocument.SetParameterValue("Name", Class.Name);

    //登录

    foreach (Table aTable in aReportDocument.Database.Tables)
    {
     aTable.LogOnInfo.ConnectionInfo.ServerName = Properties.Settings.Default.ServerName;
     aTable.LogOnInfo.ConnectionInfo.UserID = Properties.Settings.Default.UserID;
     aTable.LogOnInfo.ConnectionInfo.Password = Properties.Settings.Default.Password

     aTable.ApplyLogOnInfo(aTable.LogOnInfo);

    }

    //指定系统默认打印机位报表打印机

     PrintDocument printDc = new PrintDocument();
     aReportDocument.PrintOptions.PrinterName = printDc.PrinterSettings.PrinterName;

    //如果没有上面两句,默认打印机是在水晶报表中指定的
     aReportDocument.PrintToPrinter(1, true, 0, 0);
     aReportDocument.Dispose();

  • 相关阅读:
    系统安全方案
    模态框的使用
    thinkphp修改分页为post方式
    手动配置apache、php
    Djang之ModelForm组件的简单使用
    连接池还是连接迟?
    金融量化
    luasocket编译安装遇到的坑
    numpy&pandas补充常用示例
    Matplotlib画正弦余弦曲线
  • 原文地址:https://www.cnblogs.com/stoneFang/p/6715315.html
Copyright © 2011-2022 走看看