Curious Problem with Margins in Inherited Reports
Polomint
Australia
An obscure problem arose in our application, where the top and bottom margins were "reversed" on printed reports when laid out in Landscape format.
The set-up is quite complex, so it seemed sensible to build a minimal test application and try to eliminate factors until the root cause could be found.
The main points of the set-up are:
- the FastReport with the "wrong" margins inherits its definition from a Portrait template, changing only the Orientation to Landscape, and the text in the Report Header
- both of the Template and Descendant reports are defined in self-contained Units with their own TfrxReport component, the Descendant Unit / Form inherits its design from the Template Unit / Form
The above constraints emulate the architecture of our application and work well for keeping common stuff in one place, and "encapsulating" our Reports.
The Application and the Test Project both use FastReport Vcl Pro 5.6.4, and are built with Delphi and tested with both RAD Studio XE7 and Seattle.
The Test Project just fires off the FR Preview Form for the appropriate report when one of the buttons is clicked. We've dropped frxPDFexport component on the Main Form to allow the Previews to "dump" the result to a file.
The set-up is quite complex, so it seemed sensible to build a minimal test application and try to eliminate factors until the root cause could be found.
The main points of the set-up are:
- the FastReport with the "wrong" margins inherits its definition from a Portrait template, changing only the Orientation to Landscape, and the text in the Report Header
- both of the Template and Descendant reports are defined in self-contained Units with their own TfrxReport component, the Descendant Unit / Form inherits its design from the Template Unit / Form
The above constraints emulate the architecture of our application and work well for keeping common stuff in one place, and "encapsulating" our Reports.
The Application and the Test Project both use FastReport Vcl Pro 5.6.4, and are built with Delphi and tested with both RAD Studio XE7 and Seattle.
The Test Project just fires off the FR Preview Form for the appropriate report when one of the buttons is clicked. We've dropped frxPDFexport component on the Main Form to allow the Previews to "dump" the result to a file.
Comments
Does anyone rely on this behaviour? It looks wrong to me.
I'd like to hear the views of other FastReport v5/v6 licensees.
Meanwhile we have two options going forward:
- Zap the SetOrientation method to disable this behaviour (but will have to do it for every new version of FR installed!)
- Create a helper procedure in our FastReport Common Functions Unit, to set Orientation, saving Margins before and restoring after calling the native code
The latter is probably the more stable alternative, but produces more obscure Application Code...
Cheers, Paul