error CS0103
error CS0103: The name 'Categories' does not exist in the current context
code
TableObject table = new TableObject();
FReport = new Report();
table.ColumnCount = 8;
table.RowCount = 2 * 5;
table.Border.Lines =
BorderLines.All;
table.Border.Color = System.Drawing.
Color.Red;
table.Border.Width = 2;
// set column sizes
for (int i = 0; i < table.ColumnCount; i++)
{
table.Columns.Width =
Units.Centimeters * 3f;
}
// set row sizes
for (int i = 0; i < table.RowCount; i++)
{
table.Rows.Height =
Units.Centimeters * 0.5f;
}
table.CreateUniqueName();
// create unique name for the table rows, columns, cells
table.CreateUniqueNames();
DataBand Data1 = new DataBand();
TextObject Text1 = new TextObject();
PictureObject Picture1 = new PictureObject();
FDataSet = new DataSet();
FReport = new Report();
FDataSet.ReadXml(@C:\Program Files\FastReports\FastReport.Net Demo\Demos\Reports\nwind.xml);
Data1.AddChild(table);
FReport.RegisterData(FDataSet, "Categories");
FReport.Prepare();
//
FastReport.Data.
TableDataSource tb = new FastReport.Data.TableDataSource();
tb.ReferenceName ="Categories";
FastReport.Data.Column ReportColumn = new FastReport.Data.Column();
ReportColumn.Name = "CategoryName";
tb.Columns.Add(ReportColumn);
//
Data1.DataSource = FReport.GetDataSource("Categories");
Data1.AddChild(Text1);
Data1.AddChild(Picture1);
Text1.Text = "[Categories.CategoryName]";
Picture1.CanGrow = true;
Picture1.CanShrink = true;
Picture1.Border.Lines = BorderLines.All;
Picture1.Border.Color = System.Drawing.Color.Red;
Picture1.Border.Width = 2;
Picture1.Left = 9;
Picture1.Top = 9;
Picture1.Width = 142;
Picture1.Height = 85;
ReportPage pg = new ReportPage();
pg.Bands.Add(Data1);
FReport.AddChild(pg);
WebReport1.ReportResourceString = FReport.ReportResourceString;
WebReport1.Prepare(); // Error comes here......
// Export report to PDF stream
FastReport.Export.Pdf.
PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
using (MemoryStream strm = new MemoryStream())
{
//pdfExport.Producer.
FReport.Export(pdfExport, strm);
// Stream the PDF back to the client as an attachment
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "Application/PDF";
Response.AddHeader("Content-Disposition", "inline;filename=report.pdf");
strm.Position = 0;
strm.WriteTo(Response.OutputStream);
Response.End();
can someone suggest me something...... how can i resolve it.....
code
TableObject table = new TableObject();
FReport = new Report();
table.ColumnCount = 8;
table.RowCount = 2 * 5;
table.Border.Lines =
BorderLines.All;
table.Border.Color = System.Drawing.
Color.Red;
table.Border.Width = 2;
// set column sizes
for (int i = 0; i < table.ColumnCount; i++)
{
table.Columns.Width =
Units.Centimeters * 3f;
}
// set row sizes
for (int i = 0; i < table.RowCount; i++)
{
table.Rows.Height =
Units.Centimeters * 0.5f;
}
table.CreateUniqueName();
// create unique name for the table rows, columns, cells
table.CreateUniqueNames();
DataBand Data1 = new DataBand();
TextObject Text1 = new TextObject();
PictureObject Picture1 = new PictureObject();
FDataSet = new DataSet();
FReport = new Report();
FDataSet.ReadXml(@C:\Program Files\FastReports\FastReport.Net Demo\Demos\Reports\nwind.xml);
Data1.AddChild(table);
FReport.RegisterData(FDataSet, "Categories");
FReport.Prepare();
//
FastReport.Data.
TableDataSource tb = new FastReport.Data.TableDataSource();
tb.ReferenceName ="Categories";
FastReport.Data.Column ReportColumn = new FastReport.Data.Column();
ReportColumn.Name = "CategoryName";
tb.Columns.Add(ReportColumn);
//
Data1.DataSource = FReport.GetDataSource("Categories");
Data1.AddChild(Text1);
Data1.AddChild(Picture1);
Text1.Text = "[Categories.CategoryName]";
Picture1.CanGrow = true;
Picture1.CanShrink = true;
Picture1.Border.Lines = BorderLines.All;
Picture1.Border.Color = System.Drawing.Color.Red;
Picture1.Border.Width = 2;
Picture1.Left = 9;
Picture1.Top = 9;
Picture1.Width = 142;
Picture1.Height = 85;
ReportPage pg = new ReportPage();
pg.Bands.Add(Data1);
FReport.AddChild(pg);
WebReport1.ReportResourceString = FReport.ReportResourceString;
WebReport1.Prepare(); // Error comes here......
// Export report to PDF stream
FastReport.Export.Pdf.
PDFExport pdfExport = new FastReport.Export.Pdf.PDFExport();
using (MemoryStream strm = new MemoryStream())
{
//pdfExport.Producer.
FReport.Export(pdfExport, strm);
// Stream the PDF back to the client as an attachment
Response.ClearContent();
Response.ClearHeaders();
Response.Buffer = true;
Response.ContentType = "Application/PDF";
Response.AddHeader("Content-Disposition", "inline;filename=report.pdf");
strm.Position = 0;
strm.WriteTo(Response.OutputStream);
Response.End();
can someone suggest me something...... how can i resolve it.....
Comments