Format a Report

Format Text

Text-based controls in a report template have a number of formatting options available in Report Designer. When a Label, TextBox or CheckBox control is selected in the report canvas the text formatting options become available in the properties window, under the Appearance category. As well, quick tools to set common text properties such as font, bold, italic, underline and alignment become available on the Report Designer toolbar when one of these controls is selected. These appearance settings are useful when a text style is to be applied to a single control.

Unicode

Unicode data does not appear in print templates or reports unless the selected font is a Unicode font, such as Arial, Segoe UI, or Times New Roman. Unicode data may come from feature data or from text input by the end user.

To see a list of common Unicode fonts, see List of Unicode fonts on Wikipedia.

Use Classes

If multiple controls are to share a common text style, classes should be used rather than individual appearance settings configured per control. In this way, all controls sharing the same text style can be updated at once when any modifications are required. For those familiar with word processing programs, the concept of styles is the same in that environment.

Text-based controls have a ClassName property under the Data category. The ClassName property is a dropdown list containing all of the styles available to the report template. By default, this ClassName property is set to Normal, which is by default a normal Arial 10-point font. When adding labels to the report template that represent a report title or a report heading, alternate built-in Heading styles can be selected in the ClassName property.

The default (Normal) text style can be modified in the Styles page, accessible from the report settings dialog.  The Styles page in the report settings dialog contains the full list of styles available to the report template, and allows you to modify the four predefined styles as you see fit.

Complex reports may call for additional styles besides the four default ones; these can be created by clicking on the New button in the Styles page, giving the new Style a name, and choosing an optional base style. If a base style is selected when creating a new style, this base style inherits all of the values from the base style unless overridden. This allows changes to the base style (such as a change from a 10-point to a 12-point font) to propagate down to any controls using the new style. If a style is not assigned a base style, its style properties are not inherited from any default style. Only styles created without a base style are eligible to be used as a base style in subsequent new styles—this explains why none of the built-in Heading styles are available to be used as a base style, since they already inherit from the Normal style.

Note that if a style is modified, any existing controls on the report canvas which are set to use that style are not updated to reflect the new style until the report template is closed and re-opened in Report Designer. Alternately, you can select a different ClassName for the control then select the original ClassName again to have the new style settings reflected. For this reason, it is preferable to define all text styles in advance of adding controls to the report template rather than defining them afterward.

Align Controls

Multiple controls in a report template are typically aligned with each other to provide a neat appearance. For example, a report listing attributes of a selected set of features may have all attribute names listed on the left, with attribute values listed on the right. Aligning these Label and TextBox controls manually can be time consuming and error-prone. There are a set of tools on the Report Designer toolbar to facilitate control alignment. These tools allow you to align the right, left, top, or bottom edge of any number of controls with one another. In addition, controls can be aligned by their center point.

To use the alignment tools, first select the controls that you wish to align. You can either click on each control while holding down the Ctrl or Shift key, or you can use the mouse to drag a rectangle around all desired controls. Once selected, the controls are displayed with a different selected border containing eight resize handles. There is one control that has been selected to be the reference control. The position of this reference control is used to align the other controls. To change which control is the reference control, hold down Ctrl or Shift, and click the desired reference control twice—the first click deselects the control and the second click adds the control back to the selection as the reference control. The last control added to the selection always becomes the reference control.

With the controls selected, click the appropriate alignment tool to align the controls to the reference control.

Snap Controls to a Grid

When manually positioning controls on the report canvas, it can be advantageous to fix the control positions and sizes to a grid. The dots on the report canvas signify the grid that controls are aligned to. By default, all controls are aligned to the grid for positioning.

The resolution (pitch) of the grid can be adjusted in the report settings dialog, in the Global Settings page. By default the grid pitch is set to 24 dpi, but this can be modified as needed. Finer grid pitches (higher numbers) provide increased positioning control at the expense of more work making every control line up with one another. A more coarse grid pitch (lower number) allows for quicker positioning at the expense of decreased positioning options.

When controls snap to the grid in the report canvas, dragging the controls with the mouse automatically leaves the controls positioned in alignment with the grid. For finer control, the arrow keys on the keyboard can be used to move a control in any direction one gridline at a time. The arrow keys move the selected control (or controls, if multiple controls are selected) in the corresponding direction.

For the finest control over positioning, uncheck the Snap to Grid box in the Global Settings page of the report settings dialog.

Note that for any control, regardless of whether or not grid snapping is enabled, the position and size of the control can be explicitly set using the Location and Size properties in the Layout category. This is often the surest way to ensure different controls line up properly.

Stack Controls

Report controls can be stacked on top of one another. For example, a Label control can be stacked on top of a Picture control. When stacking controls, it becomes necessary to be able to control the stacking order so that the correct control is drawn on top. Controlling the stacking order is handled with the Bring to Front and Send to Back tools on the toolbar. These tools operate on the currently selected control on the report canvas. The Bring to Front tool moves the currently selected control to the top of the stack and the Send to Back tool moves the currently selected control to the bottom of the stack. You may also right-click on a control and choose the Bring to Front or Send to Back option from the context menu.

If a control is underneath another control, you cannot click on it to select it. In this case, you can either send the upper control to the bottom using the Send to Back tool, or you can use the control navigator to select the bottom control instead of clicking on it with the mouse. Once selected, it can be moved to the top with the Bring to Front tool.

Format Control Borders

Borders can be added to any control by right-clicking on the control and selecting Format Border. The right-click context menu is the only way to invoke the Format Border dialog, so if the control you wish to format is completely underneath another control it has to be moved to the top using the Bring to Front tool, or the top control must be moved out of the way temporarily.

Size Content Dynamically

Many report controls can have variable size content. SubReports for example, may be large if there is a lot of data to be included in the SubReport or they may be small if there is little or no data available. Controls that allow variable size content have CanGrow and CanShrink properties available in the Behavior category. These properties configure whether a report control can grow vertically to allow all data to be visible and/or shrink vertically to remove unused space from underneath the control's content. When allowing report controls to grow or shrink, be aware that it can alter the carefully positioned layout you have defined in your report template. For example, a TextBox control allowed to grow can end up pushing a neighboring control down to make room for itself.

Report sections can also be allowed to grow or shrink according to the amount of data contained within. Selecting a report section (such as Detail) reveals the CanGrow and CanShrink properties. The CanGrow property is essential when including other controls inside the section which themselves have CanGrow set to true. SubReports are a good example - when a SubReport is included in the detail section it is most often desired to allow it to grow to fit all content. If the SubReport is allowed to grow then the Detail section must also be allowed to grow otherwise the SubReport control is clipped in the final report. The default values for CanGrow and CanShrink do not often need to be modified explicitly.

Create Multi-Column Reports

In a multi-column report, the detail section repeats for each feature that is provided to the template when the report is generated. In some cases, you do not want each feature to occupy the entire width of the page; rather, you need the features to be output in columns. One popular example of this requirement is when creating a report template for mailing labels.

To enable multi-column reports in Report Designer, select the Detail section on the report canvas and set the ColumnCount property under the Data heading to the number of columns you require. For example, creating a report template designed to print mailing labels to an Avery 5160 label sheet requires 3 columns. After you change the ColumnCount for the Detail section, part of the Detail section is grayed out. You arrange the report controls in the white part of the Detail section. The gray portion of the Detail section represents the remaining width of the page, where the subsequent columns will be written. Any controls you place on the gray portion do not appear in the final output report.

The arrangement of the columns can be changed by selecting a different option in the ColumnDirection property drop-down list under the Behavior category. By default this is set to a value of DownAcross which means that when the report is generated each feature is written from top to bottom along the left edge of the page, then at the bottom of the page the next feature is written back at the top beside the first feature. Changing this value to AcrossDown causes the features to be written from the left edge to the right edge in rows.

You can set the spacing between columns explicitly using the ColumnSpacing property of the Detail section under the Data heading. This property can be useful when you are creating a multi-column report which will be printed onto mailing labels or another type of paper template with a very specific size. The units used in the ColumnSpacing property is inches or centimeters, depending on what was chosen as the Ruler Units on the Global Settings page of the Report Settings dialog. The default is inches.

In most cases when creating a multi-column report you want to set the KeepTogether property of the Detail section under the Behavior heading to True. By default this value is False. When KeepTogether is True, it prevents a single feature from spanning columns. When a feature spans columns, part of the detail section is written at the bottom of the page and part is written at the top, which can throw off the alignment of the report.

The NewColumn property under the Data heading is an advanced property that, in short, allows you to configure the report to write only a single column across the top of each page. Choose Before, After, or BeforeAfter to select when a new column should be started. If you are to use this advanced property, the best thing to do is select each option in turn and run or preview the report to see if the setting has the desired effect. See the section Linking Report Designer to a Data Source for assistance with previewing the report before running it directly.