Editing the layout of a report

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can insert items into the layout of a report:

 

[C#]

 

using CMS.Reporting;

 

...

         

        // Get report object by report code name

        ReportInfo ri = ReportInfoProvider.GetReportInfo("TestReport");

 

        // If report exists

        if (ri != null)

        {

 

            // Get graph object by code name

            ReportGraphInfo rgi = ReportGraphInfoProvider.GetReportGraphInfo("TestGraph");

            if (rgi != null)

            {

               ri.ReportLayout += "<br/>%%control:ReportGraph?" + ri.ReportName + "." + rgi.GraphName + "%%<br/>";

            }

 

                            // Get table object by code name

            ReportTableInfo rti = ReportTableInfoProvider.GetReportTableInfo("TestTable");

            if (rti != null)

            {

               ri.ReportLayout += "<br/>%%control:ReportTable?" + ri.ReportName + "." + rti.TableName + "%%<br/>";

            }

 

                            // Get value object by code name

            ReportValueInfo rvi = ReportValueInfoProvider.GetReportValueInfo("TestValue");

            if (rvi != null)

            {

               ri.ReportLayout += "<br/>%%control:ReportValue?" + ri.ReportName + "." + rvi.ValueName + "%%<br/>";

            }

 

            // Save to database

            ReportInfoProvider.SetReportInfo(ri);

        }

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_editing_the_layout_of_a_report.htm