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);
}