Exemplo n.º 1
0
        private static void LoadReportParameterMultiTest()
        {
            var rpt = new ReportDocument();

            rpt.Load(@"Reports\ReportWithParameterMulti.rpt");

            var departments = new ParameterValues();

            departments.AddValue(1);
            departments.AddValue(3);
            departments.AddValue(4);

            var p1 = new ParameterDiscreteValue {
                Value = 5
            };

            departments.Add(p1);


            rpt.SetParameterValue("Jednostki", departments);

            rpt.ExportToDisk(ExportFormatType.PortableDocFormat, "ReportWithParameterMulti.pdf");

            rpt.Close();

            rpt.Dispose();

            System.Diagnostics.Process.Start("ReportWithParameterMulti.pdf");
        }
Exemplo n.º 2
0
        private void buttonIzvjestaj_Click(object sender, EventArgs e)
        {
            try
            {
                if (listViewDokumenti.CheckedItems.Count != 0)
                {
                    ReportDocument reportRacun = new ReportDocument();
                    reportRacun.Load(@"..\..\StavkeDokumenta.rpt");

                    // postavljamo parametre (listu idDokumenta) po kojem ce se izvjesce puniti
                    ParameterValues parametri = new ParameterValues();
                    foreach (ListViewItem item in listViewDokumenti.CheckedItems)
                    {
                        parametri.AddValue(item.Text);
                    }

                    reportRacun.SetParameterValue("idDok", parametri);
                    reportViewer.ReportSource = reportRacun;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Došlo je do pogreške: " + ex.Message);
            }
        }