Reporting - Responsive Report Layouts with Control Anchoring (v20.2)

Reporting Team Blog
08 February 2021

When you design a report in the Report Designer, you can anchor controls to individual containers (to bands, panels, or table cells that host these report controls) so that they reflect changes made to the container. For instance, when you change page size, margins, or orientation, report controls are resized based on new page dimensions. This allows you to create a “responsive layout” for a report.

To create a responsive layout, set the control’s AnchorHorizontal property as desired. You can set it to Left (react to changes made to the left border), Right, or Both.

Specify the anchoring behavior in the Property Grid

The AnchorVertical property works in a similar fashion – except that the control reflects changes made to control height versus changes made to page height. See the AnchorVertical property description for more information in this regard.

Here’s how these anchor settings will affect reports generated/displayed within our Report Designer:

  • When table anchoring is disabled - no reaction to page changes:

    Table anchoring is disabled - no reaction to page changes
  • When table anchoring is active - the table follows page changes:

    Table anchoring is active - the table follows page changes

Prior to v20.2, to achieve the same effect at runtime in the Document Viewer, you had to write code to handle the PrintingSystem’s AfterMarginsChange and PageSettingsChanged events. With v20.2, this feature works out of the box. You can change margins or switch page orientation and produce the same results:

Responsive report layout in Preview

We have also recorded a short video that demonstrates how to use the horizontal anchoring functionality in DevExpress Reports.

If you’d like to read the video script associated with this video, please refer to the following PDF file: Responsive Report Layouts with Control Anchoring in Print Preview Video Script.

Your Feedback Matters

As always, we welcome your thoughts. Please comment below and let us know what you think about our anchoring feature. Should you have technical questions, feel free to contact us via the DevExpress Support Center.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.