C#中, 动态的将图片传递给ReportViewer中的报表. - 自动打印

  private void frmReport_Load(object sender, EventArgs e)
        {
                this._reportViewer.Reset();
                this._reportViewer.LocalReport.ReportPath = "LabelTemplate.rdlc";

         

                _reportViewer.ProcessingMode = ProcessingMode.Local;
                ReportDataSource dsSource = new ReportDataSource("ds", LabelModels);
                this._reportViewer.LocalReport.DataSources.Clear();
                this._reportViewer.LocalReport.DataSources.Add(dsSource);
                this._reportViewer.ShowParameterPrompts = false;
                this._reportViewer.RefreshReport();
                this._reportViewer.RenderingComplete += new RenderingCompleteEventHandler(PrintLabelDirectly);
            //}
        }
        public void PrintLabelDirectly(object sender, RenderingCompleteEventArgs e)
        {
            try
            {

                _reportViewer.PrintDialog();
                _reportViewer.Clear();
                _reportViewer.LocalReport.ReleaseSandboxAppDomain();
                this.Close();
            }
            catch (Exception ex)
            {
            }
        }

你可能感兴趣的:(report,WPF)