Winform rdlc 报表的直接打印

本文介绍了如何在Winform应用中利用rdlc报表进行直接打印。通过引入ReportClass类,并在需要打印的页面引用Microsoft.Reporting.WinForms,然后在打印按钮的事件处理代码中实现报表的打印功能。
摘要由CSDN通过智能技术生成

把类 ReportClass 引入项目

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;
using Microsoft.Reporting.WinForms;
using System.Text.RegularExpressions;
using System.Text;
using System.Windows.Forms;

namespace SellManage
{
    class ReportClass
    {
        private static int m_currentPageIndex;  //用来记录当前打印到第几页了
        private static IList<Stream> m_streams;  //LocalReport对象的Render方法会将报表按页输出为多个Stream对象。

        public static void Print(LocalReport report)
        {
            Export(report);
            m_currentPageIndex = 0;
            if (m_streams == null || m_streams.Count == 0)
                return;

            //声明PrintDocument对象用于数据的打印 
            PrintDocument printDoc = new PrintDocument();

            //指定需要使用的打印机的名称,使用空字符串""来指定默认打印机 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值