Error while create report on runtime

Stimulsoft Dashboards.WEB discussion
Post Reply
Ryan.A
Posts: 17
Joined: Mon May 14, 2018 7:59 am

Error while create report on runtime

Post by Ryan.A »

Hi,

When I try to export from a report that I created from code, I get this error Invalid token ';' in class, struct, or interface member declaration.

Code: Select all

	  public void ExportData(DataTable dt)
        {
            StiReport report = new StiReport();
            report.ReportUnit = StiReportUnitType.Centimeters;
            report.RegData("DataTable", dt);
            report.Dictionary.Synchronize();

            StiPage page = report.Pages[0];

            //Create HeaderBand
            StiHeaderBand headerBand = new StiHeaderBand();
            headerBand.Height = 0.5;
            headerBand.Name = "HeaderBand";
            page.Components.Add(headerBand);

            StiDataBand dataBand = new StiDataBand();
            dataBand.DataSourceName = "DataTable";
            dataBand.Height = 0.5;
            dataBand.Name = "DataBand";
            page.Components.Add(dataBand);

            foreach (DataColumn column in dt.Columns)
            {
                string columnName = column.ColumnName;
                StiText headerText = new StiText();
                StiText dataText = new StiText(new RectangleD(0, 0, 5, 0.5));

                headerText.Text = column.ColumnName;
                headerText.Name = "HeaderText" + column.Ordinal;

                dataText.Text = "{DataTable." + columnName + "}";
                dataText.Name = "DataText" + column.Ordinal;

                headerBand.Components.Add(headerText);
                dataBand.Components.Add(dataText);
            }

            report.ReportName = "Results";
            report.ReportFile = "Results";

            ExportExcel(report);
        }
Please help me.
Attachments
Test.mrt
(8.28 KiB) Downloaded 134 times
Ryan.A
Posts: 17
Joined: Mon May 14, 2018 7:59 am

Re: Error while create report on runtime

Post by Ryan.A »

Just ignore this post. I already solved it.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Error while create report on runtime

Post by Lech Kulikowski »

Hello

Ok.
Please let us know if you need any additional help.

Thank you.
Post Reply