Wednesday, March 7, 2012

ReportItemCollection

I've asked this question in a few different forums and so far I've had not response, I hope I have some better luck here.

I'm writing a custom rendering control to render very basic reports in WML. I'm stumbling at the first hurdle, though. I've added references to "Microsoft.ReportingServices.Interfaces" in my project and "Microsoft.ReportingServices.ProcessingCore" and I've added 'using' directives for "Microsoft.ReportingServices.Interfaces" and "Microsoft.ReportingServices.ReportRendering" in the code page.

Now, according to the MSDN library, the Report object has a property called Body which returns the body of the report as a Rectangle object. A Rectangle object has a property called ReportItemCollection which provides access the the collection of ReportItem objects contained within the Rectangle. According to the MSDN documentation, the individual report items can be accessed using the Item property of the ReportItemCollection, however when I attempt to access this property in my code, I am informed that there is no such property available. The property also doesn't appear in Intellisense.

I'd be very interested in any responses on this subject - has anyone else had the same problem? Am I blatantly barking up the wrong tree? Please help!

Thanks in advance,
Pete.

NB. This post is regarding SQL Server 2005 Custom Rendering Extensions.

The ReportItemCollection has an indexer. When writing code in VB, indexers can be named, such as .Item(0) - that's probably why the documentation says there is an Item property.

In C#, you can just write the following code:
Report.Body.ReportItemCollection[0]

-- Robert

|||Thanks Robert - I ended up downloading Reflector and decompiling Microsoft's HTML Renderer to see how it was done. I have it working now. Thanks.

No comments:

Post a Comment