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 |
} |
} |
I am new to Telerik Reporting however I have been using RadControls for over 2 years now. I am currently working on an RMS (Records Management System) project for several clients. Needless to say I don’t feel like dealing with all the baggage within Crystal Reports (I can’t stand the viewer) and since I have been “Telerikized” I figured I’d give reporting a shot. I need to display an image in the Page Header that is unique to each client. It has to be able to be loaded dynamically depending on the designated client. Is there any way to do this without having to use a dataset? Parameters?
Bernard J Bobinski
En4cer Web Systems
myReport.mypic.Value = "C:\\temp\\picture.jpeg";
myReport is the report and mypic is the picturebox.
i have created a picture box on the report and
on the calling aspx file i give like this.
but the report is not opening that picture.
is there any thing else i have to do.
Me.sqlSelectCommand1.Parameters.AddRange(New System.Data.SqlClient.SqlParameter() {New System.Data.SqlClient.SqlParameter("@user_id", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "user_id", System.Data.DataRowVersion.Current, "aaa")}) |