Using the new FlexReport properties
FireOnFormatForEachInstanceOfRepeatedGroupSection and IgnoreMarginsForEmptyFields are two new FlexReport properties.
The use cases mentioned here will give you an idea of how these properties can be used.
This property is used to define if the OnFormat script is fired for each instance of group footer. It only affects group footer sections. This property improves compatibility with C1Report in parts of processing groups/group sections.
Let’s see how a report’s group footer is assigned the BackColor, based on this property. When the group footer is rendered (for the last time for a group), the BackColor is set to Blue, otherwise it is Green.
Here, we increment the value of a variable val in GroupFooter.OnFormat and change the BackColor in GroupFooter.OnPrint, based on this value.
- Set/Reset in GroupHeader0.OnFormat: val=0
- Increment in GroupFooter0.OnFormat: val=val+1
- Set BackColor in GroupFooter0.OnPrint:
If val=0 Then
When FireOnFormatForEachInstanceOfRepeatedGroupSection is set to False, OnFormat is fired only once; therefore, there is a change in the value of ‘val’ for the last instance. This gives us a way to assign different colors to the GroupFooter based on the values obtained from the number of times the GroupFooter.OnFormat is fired.
This report file contains a Products Report demonstrating this implementation.
This property indicates whether for empty fields with FieldBase.AutoHeight or FieldBase.AutoWidth set to AutoSizeBehavior.CanShrink, margins and borders will have zero heights or widths in the generated report layout.
Generally, for empty fields with margins set, the margins are not ignored. It may appear like something is missing from the particular location. However, setting the property to True, will help create a well-designed report layout without showing any empty field margins.
The margins for the empty fields are ignored, using this property.
The screenshot below shows how the field containing the Title looks, in the two different scenarios:
When the property is set to True, the field is properly aligned and the margins don’t disrupt the rendering of the empty field. This report file contains a Customer Report demonstrating how this is implemented.
Have you implemented these properties in different ways? Share your ideas in the comments below! Happy Reporting!