I'm trying out the Telerik Reporting software. Everytime I try to display a report that I've created I get the same error...
System.NullReferenceException: Object reference not set to an instance of an object.
at Telerik.Reporting.ImageRendering.CanvasBase.MeasureString(...)
...and the error message goes on much longer than that.
I even get this error when following the Quick Start tutorial.
Can someone help me out so I can evaluate whether or not Telerik Reporting is suitable for my project.
Thanks, Bryan
private void ShowReport(DataTable mydt1) |
{ |
try |
{ |
Report report = new Report(); |
DetailSection detail = new DetailSection(); |
Telerik.Reporting.ReportItemBase[] mylist = new ReportItemBase[mydt1.Columns.Count]; |
int icol = 0; |
foreach (DataColumn col in mydt1.Columns) |
{ |
mylist[icol] = createtextbox(col.ColumnName.ToString()); |
icol++; |
//detail.ColumnCount++; |
} |
detail.Items.AddRange(mylist); |
report.DataMember = "HIPAAlog"; |
report.DataSource = mydt1; |
report.Items.Add((ReportItemBase)detail); |
detail.KeepTogether = false; |
ReportViewer1.Report = report; |
ReportViewer1.Visible = true; |
} |
catch (Exception ex) |
{ |
throw (ex); |
} |
} |
private void ShowReport(DataTable mydt1) |
{ |
try |
{ |
Report report = new Report(); |
//DetailSection detail = new DetailSection(); |
//Telerik.Reporting.ReportItemBase[] mylist = new ReportItemBase[mydt1.Columns.Count]; |
//int icol = 0; |
//foreach (DataColumn col in mydt1.Columns) |
//{ |
// mylist[icol] = createtextbox(col.ColumnName.ToString()); |
// icol++; |
// //detail.ColumnCount++; |
//} |
//detail.Items.AddRange(mylist); |
report.DataMember = "HIPAAlog"; |
report.DataSource = mydt1; |
//report.Items.Add((ReportItemBase)detail); |
detail.KeepTogether = false; |
ReportViewer1.Report = report; |
ReportViewer1.Visible = true; |
} |
catch (Exception ex) |
{ |
throw (ex); |
} |
} |
private Telerik.Reporting.TextBox createtextbox(string FieldName) |
{ |
Telerik.Reporting.TextBox textBox2 = new Telerik.Reporting.TextBox(); |
textBox2.Value = "=[" + FieldName + "]"; |
textBox2.TextWrap = false; |
textBox2.CanGrow = true; |
textBox2.CanShrink = true; |
return textBox2; |
} |
Hi, when I publish my site I get this error:
Configuration Error
Line 53: <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> Line 54: <add assembly="Telerik.Reporting.Interfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE"/> Line 55: <add assembly="Telerik.Reporting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE"/> Line 56: <add assembly="Telerik.Reporting.Processing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"/></assemblies> Line 57: </compilation> |
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. |
Hello! I'm attempting to build a simple set of reports against a development project that is currently using SQL Reporting 2005, which has some shortcomings I think your product may handily overcome.... if I can only figure out what I'm doing wrong here.
My web app needs to generate PDF reports and display them to the user. Here's the code I'm trying to use against the telerik Reporting. Note that I'm trying to pull the rendered PDF into a byte array and pass that array directly to the context.Response object. (This is very similar to what I do with SSRS, which is working.) Unfortunately, with the telerik report in the code below, when the Adobe Reader opens on the client's system, an error message pops up that reads "there was an error opening this document. The file is damaged and could not be repaired." (This was with Adobe Reader 7.0.8 by the way.)
Note that there's some lines in the code below that are commented out - these are pulling the PDF into a FileStream and writing it to a file - if I try to open the file thus created, it works like a charm!! (same version of the reader.)
I'd like to avoid all that sloppy file writing... any ideas what in the world I'm doing wrong here????
Oh, and thanks for letting us use the beta of what looks to be a fabulous product... I was sold as soon as I realized the codebehind was C# and not some horrible VBA like what SSRS uses!
JobList report = new JobList(); |
string mimeType = string.Empty; |
string extension = string.Empty; |
Encoding encoding = null; |
byte[] RenderedRptArr = Telerik.Reporting.Processing.ReportProcessor.Render("PDF", report, null, out mimeType, out extension, out encoding); |
//FileStream sOut = new FileStream("c:\\dev\\joblist.pdf", FileMode.CreateNew, FileAccess.Write); |
//sOut.Write(RenderedRptArr, 0, RenderedRptArr.Length); |
//sOut.Close(); |
System.Web.HttpContext context = System.Web.HttpContext.Current; |
string strPath = context.Request.ApplicationPath; |
Response.AppendHeader("content-disposition", "attachment; filename=JobList.pdf"); |
Response.Clear(); |
Response.ContentType = "application/pdf"; |
context.Response.BinaryWrite(RenderedRptArr); |
Response.Flush(); |
private void textBoxDescription_ItemDataBound(object sender, System.EventArgs e) |
{ |
Telerik.Reporting.Processing.TextBox textBoxDescription = (Telerik.Reporting.Processing.TextBox)sender; |
if (textBoxDescription.Text == "") |
{ |
textBoxDescription.Visible = false; |
labelDescription.Visible = false;//This doesn't work |
} |
} |