Skip to Content
0
Former Member
Mar 24, 2015 at 10:42 PM

CR .Net - Getting field values for each section at runtime

221 Views

I am porting our integration with CR from the old COM based component to CR .Net. I'm using the latest version ((v.13.0.13.1597) for Visual Studio.

Our reports contain BLOB fields which are used throughout the sections, including repeating Details sections. Our database stores the desired width, height, and position of the BLOB field. For convenience, we add the width/height/position database fields as suppressed fields in the report so that we can easily access the values at runtime.

In our existing COM implementation we hook into the ISectionFormat event for each section that contains a BLOB field, and then when these events fire we iterate through the ReportObjects in the section to locate our dimension/position fields by name, something like...

IReportObjectPtr l_ReportObjectPtr = pReport->GetSections()->Item[ sectionNumber ]->GetReportObjects()->Item[ reportObjectIndex ];

if(l_ReportObjectPtr->Kind == crFieldObject )

{

l_FieldObject = l_ReportObjectPtr;

if( l_FieldObject->Name.GetBSTR() == HEIGHT_FIELD_NAME)

m_lfImageHeight = l_FieldObject->Value;

}

Once we have the values, we then again iterate through the ReportObjects in the Section that triggered the event to find the BLOB field and set the width/height/top/left values on the fieldObject accordingly.

How do I achieve this with the .NET SDK as the FieldObject->Value is no longer available?

I know that I can use the RAS SDK to access the data at runtime, but I can't seem to find any concept of the "current" row. I can hook into the new FormatSection event but there doesn't appear to be a way to find the section object that fired the event to get to the fields within it, or to then access the corresponding data values.

The overarching requirement is to allow our users to store BLOB images in our database along with the dimensions (in TWIPS). When they print the report, the BLOB's (and the sections within them) need to be resized on a row by row (section by section) basis to match the dimensions stored in the database. Is there a different way to achieve this in with the .NET SDK's if I can no longer do it the way we did with the COM component?