Manipulate Report Controls
- 6 minutes to read
This document describes how to manipulate report controls in the Report Designer and customize the report's layout.
Access Report Element Settings
You can use the Property Grid to access selected element settings.
Click the gray area around the design surface to select the report.
You can also use an element's smart tag to access its most commonly used settings.
Smart tags are available for most report controls, bands and a report itself.
In addition to properties, smart tags can contain context links enabling you to perform various actions.
These commands are also available in the Property Grid.
Move and Resize Report Controls
You can move report controls using the mouse in the same way you move other controls in Visual Studio. To select multiple controls, press and hold the SHIFT or CTRL key and click the required controls.
You can select all the controls within a specific area by clicking an empty place on a report's surface and drawing a rectangle around the required controls.
Use the handles displayed around selected controls to change their size.
You can also use the Report Explorer to move a control. You can move controls to other bands (except DetailReportBand), or into an XRPanel or XRTableCell controls. Select a control and drag it (either within the Report Explorer or to the design surface). The drop targets are highlighted when you drag the control over them.
Apply Styles to Report Controls
As an alternative, you can drag a style from the Report Explorer onto a control.
Copy Report Controls
You can clone report controls. Hold the CTRL key and select a control, then move the mouse to the new control's location. The new control has the same settings as the initial control.
You can also copy report controls to the clipboard using CTRL + C or the Copy command, and then paste these controls to a new container or band.
The original control positions are preserved when you use the CTRL + V hotkey or the Paste toolbar command to insert controls.
The pasted controls are repositioned by an offset of 10 units on both axes if another control already occupies the target position.
When you use the Paste context menu item, controls are inserted at the position where you invoked the context menu.
Reuse Report Controls
You can add selected controls to the Report Gallery and reuse them later in other reports.
To add a selected template to a report, drag it from the Report Gallery onto a report's surface.
A template stores various settings related to its controls, such as binding information and appearance options. All these settings are restored after you add controls to a report.
Arrange Report Controls
The following tools allow you to control report element size, location, alignment, and to maintain the distance between them:
The Report Designer provides horizontal and vertical rulers to help you determine report elements' size and location.
Use the Layout Toolbar commands to align report controls.
A report's XtraReport.SnappingMode property defines whether automatic report control snapping is enabled and allows you to switch between snapping to a grid and/or snap lines.
The report's design surface displays a visual grid by default, which allows you to determine elements' size and location in a report. Use the XtraReport.SnapGridSize and XtraReport.SnapGridStepCount properties to customize the grid settings.
Set the XtraReport.DrawGrid property to false to hide the grid.
Use the context menu to align the selected controls to the grid cells.
A report control is aligned to the nearest grid cell when moved with the mouse or ARROW keys.
Hold down ALT when you use the mouse, or CTRL when you use the keyboard, to move or resize controls without snapping to the grid.
The Report Designer displays snap lines when you move or resize report controls. This enables you to align these controls to other report elements.
When you move a report control with the ARROW keys or resize it with SHIFT+ARROW, this control is aligned to the nearest report element's snap line.
Hold down ALT when you use the mouse, or CTRL when you use the keyboard, to move or resize controls without snapping.
Convert Labels to Table
Hold CTRL or SHIFT and click labels to select them. Right-click any of the selected labels and select Convert To Table from the context menu. A table with one row is added to the report instead of the selected labels.
The Convert To Table option is not available if any of the selected labels overlap horizontally.
The created table occupies horizontal space from the leftmost label's left edge to the rightmost label's right edge, and vertical space from the topmost label's top edge to the lowest label's bottom edge.
The horizontal gap between labels is included in the left cell.
The table cells copy all property values from the labels.
Add Report Controls to Containers
The Panel control allows you to place various report controls on it to combine them into a group.
You can use this panel to move, copy, change appearance settings, etc. instead of adjusting individual controls.
A table cell can also act as a container for other controls.
Both panel and table cells cannot contain the following report controls:
- XRCrossBandLine and XRCrossBandBox
If a panel or table cell includes only one control, you can use the Fit Bounds to Container command in the context menu to position the control within the container. This command resizes the control so that it occupies all the available space (except borders).
Validate the Report Layout
Your report layout should meet the following requirements to be correctly exported to specific formats:
Avoid overlapping controls
Overlapping controls are highlighted in red.
To ignore this rule and disable the highlight for overlapping controls, set the DesignerOptions.ShowExportWarnings property to false.
Avoid placing controls outside page margins
Controls that do not fit into the printable page area are highlighted in red.
To ignore this rule and disable the highlight for controls that overlap page margins, set the DesignerOptions.ShowPrintingWarnings property to false.