RDLC 报表打印

报表rdlc怎样直接打印? 原帖地址:

http://bbs.csdn.net/topics/370121874

http://bbs.csdn.net/topics/370121874

http://bbs.csdn.net/topics/370121874

报表rdlc怎样直接打印? [问题点数:100分,结帖人zhao_zps]


using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Reporting.WinForms;



namespace RDLCPrinter
{
    /// <summary>
    /// 通过RDLC向默认打印机输出打印报表
    /// </summary>
    public class BillPrint:IDisposable
    {
        /// <summary>
        /// 当前打印页号
        /// </summary>
        static int m_currentPageIndex;

        /// <summary>
        /// RDCL转换stream一页对应一个stream
        /// </summary>
        static List<Stream> m_streams;

        /// <summary>
        /// 把report输出成stream
        /// </summary>
        /// <param name="report">传入需要Export的report</param>
        private void Export(LocalReport report)
        {
            string deviceInfo =
              "<DeviceInfo>" +
              "  <OutputFormat>EMF</OutputFormat>" +
                //"  <PageWidth>2in</PageWidth>" +
                //"  <PageHeight>20in</PageHeight>" +
                "  <MarginTop>0in</MarginTop>" +
                "  <MarginLeft>0in</MarginLeft>" +
                "  <MarginRight>0in</MarginRight>" +
                "  <MarginBottom>0in</MarginBottom>" +
              "</DeviceInfo>";
            Warning[] warnings;
            m_streams = new List<Stream>();
            report.Render("Image", deviceInfo, CreateStream, out warnings);
            foreach (Stream stream in m_streams)
                stream.Position = 0;
        }

        /// <summary>
        /// 创建具有指定的名称和格式的流。
        
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值