日期:2014-05-17  浏览次数:21220 次

vs2010 winform中rdlc 报表如何直接打印
谁有直接打印的代码?  

因为我要打印发票, 如何设置走纸问题, 现在总是跑两页.第二页是空的....

------解决方案--------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Imaging;
using System.IO;
using System.Drawing.Printing;
using Microsoft.Reporting.WinForms;

namespace DLAFMS.RVP {
    public class ReportPrintImpl {
        private List<Stream> m_streams;
        private int m_currentPageIndex;
        public int CurrentPageIndex {
            get { return m_currentPageIndex; }
            set { m_currentPageIndex = value; }
        }
        private PrintDocument pDocument;
        public PrintDocument PDocument {
            get { return pDocument; }
            set { pDocument = value; }
        }

        public ReportPrintImpl() {
            pDocument = new PrintDocument();
            pDocument.PrintPage += new PrintPageEventHandler(pDocument_PrintPage);
        }

        /// <summary>
        /// 呈现报表
        /// </summary>
        /// <param name="report">报表</param>
        public void Export(LocalReport report) {
            StringBuilder deviceInfo = new StringBuilder();
            deviceInfo.Append("<DeviceInfo>")
            .Append(" <OutputFormat>EMF</OutputFormat>")
            .Append(" <PageWidth>8.5in</PageWidth>")