printgrid

Stimulsoft Reports.NET discussion
Post Reply
maryam
Posts: 26
Joined: Tue Jun 05, 2012 1:13 am

printgrid

Post by maryam »

Hi, I want to print grid with stimulsoft, when I run porgram, when trace receive to line "report.render(fase);" I have an error " error CS1519: Invalid token ';' in class, struct, or interface member declaration" How I can to solve this problem? please help me, my code is here:

private void PrintDataGrid(RadGridView sender)
{
DataTable dt = (DataTable)sender.DataSource;
//StiReport report = new StiReport();
report.ScriptLanguage = StiReportLanguageType.CSharp;


report.RegData("view", dt);

//Fill dictionary
report.Dictionary.Synchronize();
StiPage page = report.Pages.Items[0];


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


StiDataBand dataBand = new StiDataBand();
dataBand.DataSourceName = "view" + dt.TableName;
dataBand.Height = 0.5f;
dataBand.Name = "DataBand";
page.Components.Add(dataBand);


Double pos = 0;
Double columnWidth = StiAlignValue.AlignToMinGrid(page.Width / dt.Columns.Count, 0.1, true);
int nameIndex = 1;
foreach (DataColumn column in dt.Columns)
{


StiText headerText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5f));
headerText.Text.Value = column.Caption;
headerText.HorAlignment = StiTextHorAlignment.Center;
headerText.Name = "HeaderText" + nameIndex.ToString();
headerText.Brush = new StiSolidBrush(Color.LightGreen);
headerText.Border.Side = StiBorderSides.All;
headerBand.Components.Add(headerText);

StiText dataText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5f));
dataText.Text.Value = "{view" + dt.TableName + "." +Stimulsoft.Report.CodeDom.StiCodeDomSerializator.ReplaceSymbols(column.ColumnName) + "}";
dataText.Name = "DataText" + nameIndex.ToString();
dataText.Border.Side = StiBorderSides.All;

dataBand.Components.Add(dataText);

pos += columnWidth;

nameIndex++;
}

report.Render();
report.Show();
}
private void btnExtra_zOnClickPrint(EventArgs e)
{
PrintDataGrid(GrdBase);
}


best regard.
maryam
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

printgrid

Post by Alex K. »

Hello,

Can you please send us a sample project with test data for analysis.

Thank you.
Post Reply