Archive for the ‘Active Reports’ category

Value cannot be null. Parameter name: instance regarding active reports

February 14th, 2013

Are you getting a error screen when you try to open your Active Report design files similar to this one?
screenshot

I was beating my head into the wall trying to figure this one out and finally simply removing all the active report references I had in my project and adding them back in, then doing a Build->Rebuild Solution did the trick, hope this helps.

Adobe Acrobat (PDF) files not displaying correctly on iPad?

October 30th, 2012

I have been working on an adobe acrobat export routine on the web that uses ComponentOne’s Active Reports tool to generate the files and I ran into a bit of a snag when trying to display the files on the iPad. I have posted the code below:

HttpResponseMessage message = null;
var pdfExport = new PdfExport();
var m_stream = new System.IO.MemoryStream();

var rpt = new YourActiveReport();
rpt.Run();

pdfExport.Export(rpt.Document, m_stream);
m_stream.Position = 0;
message = Request.CreateResponse(HttpStatusCode.OK);
message.Content = new StreamContent(m_stream);

message.Content.Headers.Add("Content-Disposition", "attachment; filename=yourreportname.pdf");
//this is the magic line
message.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
return message;

I put a comment on the line that looks like this:
message.Content.Headers.ContentType = new MediaTypeHeaderValue(“application/pdf”);
I didn’t have that line in before and it will work just fine on standard machines like your desktop in your browser but since the ipad either doesn’t allow plugins inside safari or doesn’t know how to handle attachments the pdf was coming back as garbage, basically displaying the raw postscript in the browser, that wasn’t cool. All you have to do is add that line in and all is well, I hope this helps someone.

GrapeCity ActiveReports (Formerly DataDynamics ActiveReports) DataBinding

February 1st, 2012

I have been a long time user of Active Reports for Visual Basic 6 and then in the .net world, I think I have used every version of ActiveReports since they released the first version.  I wanted to write about a little known fact that you may or may not know about this tool that could save you from writing tons of logic to get the data displayed you want.  Lets say you have a couple of simple classes like below:

public class Person{
     public string Name {get;set;}
     public Job Job {get; set;}
}

public class Job {
     public string Status {get; set;}
}

You may already know that just by simply making any field on your report with the DataField of “Name” will automatically bind that property to that field as long as your datasource is set to a collection of Person objects. But did you know that the DataField can work like so:

So as you can see, if your Person object has a Job object in it and there is a string property on there called status, it will display it as long as the property is public. Another caveat to this is if you have a null object in that string, you may not get an error tossed up to your UI, which could make for some fun debugging. Even still, this is a very nice feature that I have long forgotten but recently came across and it was one of those forehead slapping times.