How to generate an RDLC file using C# during runtime
Asked Answered
S

5

17

I'm doing some application development (CRM solution) which require generating diagrammatically an RDLC file at runtime. How do I do that?

Superfuse answered 30/7, 2010 at 7:33 Comment(0)
M
15

You can use 'Generate RDLC dynamically - Table' example from got reportviewer? page

Manipular answered 30/7, 2010 at 8:3 Comment(0)
S
2

Thanks for the response from all who answered this question, but I found one good article to generate dynamic reports: Dynamic Reports with Reporting Services.

Superfuse answered 30/7, 2010 at 9:59 Comment(0)
L
1

Can I confirm that you are trying to build a dynamic reporting solution based on RDLC, or do you just need to mine the data stored in the CRM and show it in a RDLC. I guess you've exhausted other tools such as Proclarity and Excel for users to mine data.

Assuming the former (i.e. an RDLC designer), then RDLC is just an XML file, so I guess you could create simple, standard RDLC's containing datasources, field definitions, cells etc by applying an XSLT after first exporting some kind of xml 'model' from your designer?

Sounds like a lot of work ;)

Lakieshalakin answered 30/7, 2010 at 7:57 Comment(0)
B
1

ALL you have to do is change the the data source by coding. like

        ReportViewer.LocalReport.DataSources.Clear();
        ReportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;


        ReportDataSource RDS = new ReportDataSource();
        RDS.Name = "DataSet";


        RDS.Value = itemReportTableBindingSource;
        ReportViewer.LocalReport.ReportEmbeddedResource = "RFID.Reports.ItemsReport.rdlc";
        ReportViewer.LocalReport.DataSources.Add(RDS);

        this.itemReportTableTableAdapter.Fill(this.reportsDataSet.ItemReportTable);
        this.ReportViewer.RefreshReport();
Butterflies answered 17/6, 2014 at 10:30 Comment(0)
S
0

You should consult this link it might be helpful

How to dynamically add new columns to report created with Reporting Services?

RDLC Report is a XML file and by editing it in XMLDocument you can modify locate /Report/Body/ReportItems/Table node and do the following inside it

  • define the header of a new column – add a new TableCell inside Header node
  • bind the column with data (from DataTable) – add a new TableCell inside Details node
  • define the width of the colum – add a new TableColumn inside TableColumns
Saddlecloth answered 15/7, 2014 at 21:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.