Esempio n. 1
0
        private void buttonSavedPartnerReportSilentPrint_Click(object sender, EventArgs e)
        {
            // https://msdn.microsoft.com/en-us/library/ms252091.aspx

            using (ServiceReference.ServiceClient client = new ServiceReference.ServiceClient())
            {
                using (LocalReport localReport = new LocalReport())
                {
                    BaseDataSource datasource = client.GetSavedReport(1);

                    if (datasource != null)
                    {
                        datasource.Configure(localReport);

                        using(LocalReportPrinter localReportPrint = new LocalReportPrinter(localReport/*, "Microsoft XPS Document Writer"*/))
                        {
                            localReportPrint.Print();
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void buttonSavedPartnerReport_Click(object sender, EventArgs e)
        {
            using (ServiceReference.ServiceClient client = new ServiceReference.ServiceClient())
            {
                BaseDataSource datasource = client.GetSavedReport(1);

                if (datasource != null)
                {
                    datasource.Configure(this.reportViewer.LocalReport);
                }
                else
                {
                    this.reportViewer.Clear();
                }

                this.reportViewer.RefreshReport();
            }
        }