So I’m still suffering from working with Crystal Reports.
Here’s some funniness I’m having trouble understanding.. maybe YOU can help!
I’m trying to calculate a page count for a section in a crystal report. Here’s what my test looks like:
I’m trying to retrieve the last page number for a section in a crystal report so that i can generate a table of contents.
It seems that this trivial task isn’t as easy as I believe it should be, so this is my work around.
The code to pass this test looks like this:
But when I run the test I get this error…
I don’t get it… so i popped open reflector to see what I might be able to find.
It turns out that the “FormatEngine” type is located in an assembly called “CrystalDecisions.
CrystalReports.Engine” which is installed in the GAC.
(I haven’t quite found out how to pull this out of the GAC so that we can xcopy deploy this assembly with the rest, and i don’t believe you can.
Correct me if i’m wrong, please!)
Also, the constructor on “FormatEngine” is defined as ‘internal’.
I noticed that the “FormatEngine” type is implementing the interface “IReportSource”.
So I tried stubbing that out instead in place of the “FormatEngine” property on the “ReportDocument”.
On got this message: