2331572 - How to use the Format section event trigger at report creation time in CR for VS .NET the same way the RDC was able to?

SAP Knowledge Base Article - Public

2331572 - How to use the Format section event trigger at report creation time in CR for VS .NET the same way the RDC was able to?

Symptom

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?

Environment

  • Crystal Reports XI R2 RDC component
  • Crystal Reports for Visual Studio

Reproducing the Issue

Forum post - http://scn.sap.com/message/16525057#16525057 I am porting our integration with CR from the old COM based component to CR CR .Net. I'm using the latest version ((v.13.0.13.1597) for Visual Stu Studio. Our reports contain BLOB fields which are used throughout the sections, in including repeating Details sections. Our database stores the desired wi width, height, and position of the BLOB field. For convenience, we add th the width/height/position database fields as suppressed fields in the rereport so that we can easily access the values at runtime. In our existing COM implementation we hook into the ISectionFormat event f for each section that contains a BLOB field, and then when these events f fire we iterate through the ReportObjects in the section to locate our ddimension/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 i in the Section that triggered the event to find the BLOB field and set tthe width/height/top/left values on the fieldObject accordingly. How do I achieve this with the .NET SDK as the FieldObject->Value is no lon longer available? I know that I can use the RAS SDK to access the data at runtime, but I ca can't seem to find any concept of the "current" row. I can hook into ththe new FormatSection event but there doesn't appear to be a way to find th the section object that fired the event to get to the fields within it, or or to then access the corresponding data values. The overarching requirement is to allow our users to store BLOB images iin our database along with the dimensions (in TWIPS). When they print tthe report, the BLOB's (and the sections within them) need to be resized o on a row by row (section by section) basis to match the dimensions s stored in the database. Is there a different way to achieve this in w with the .NET SDK's if I can no longer do it the way we did with the COM c component?

Resolution

SAP Developers have looked into this enhancement request and determined that we no longer allow users to hook into the formatting engine event component.

There is no work around other than possibly using the Section Format Formula to resize and replace the OLE objects.

There may be other ways to do this but at this time nothing more to suggest.

Keywords

KBA , BI-RA-CR-SDK , SDK related, including Java/.NET etc. , Problem

Product

SAP Crystal Reports, version for Visual Studio all versions