Exemplo n.º 1
0
        private void btnProcess_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            LoadData loadData = new LoadData();

            auditDatas = loadData.Analyze(txtSelectedFile.Text);

            //dataGridView1.DataSource = auditDatas.Where(x => !String.IsNullOrEmpty(x.remark)).ToList();
            Cursor = Cursors.Default;

            ReportDataSource datasource = new ReportDataSource("DataSet1", auditDatas.Where(x => !String.IsNullOrEmpty(x.remark)).ToList());

            this.reportViewer1.LocalReport.ReportPath = "report1.rdlc";

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(datasource);
            this.reportViewer1.RefreshReport();

            //byte[] byteViewerExcel = this.reportViewer1.LocalReport.Render("Excel");

            //this.reportViewer1.LocalReport.ListRenderingExtensions();

            //FileStream newFile = new FileStream(Path.GetFileNameWithoutExtension(txtSelectedFile.Text)+"_"+DateTime.Now.ToString("yyyyMMdd"), FileMode.Create);
            //newFile.Write(byteViewerExcel, 0, byteViewerExcel.Length);
            //newFile.Close();

            Console.WriteLine();
        }