Formatting Objects

Objectives

After completing this lesson, you will be able to:

  • Enhance the report appearance

The Format Editor

Explore some of the report formatting options.

Using the Format Editor is another, more complex method of formatting. Some of the more frequently used features of the Format Editor are the options listed on these tabs:

Common
On the Common tab, you can suppress the field, keep the field together if a record spans more than one page, control borders of the field, limit the number of lines that the field can print, rotate and align text, add tool-tip text, and lock the size and position of the selected object.
Border

On the Border tab, you can select line styles, drop shadows, and the color for the border and the background. Clicking Background opens a second color selection list for you to choose a fill color for the text object.

Font

On the Font tab, your options include the changing the font, style, size, and color. You can also add a strikeout (a line through text) and underline effects. The sample box shows you the results of your choices.

Hint
Many of the attributes that you see in the Format Editor have the formula buttons next to them. These buttons are used for conditional formatting, or applying a condition to a specific format using a formula.
Paragraph

If you select a string field or text object to format, the Format Editor offers these options on the Paragraph tab.

First Line
Enter the distance in inches (or the default measurement for your report) that you want the first line of the paragraph to be indented from the rest of the paragraph. 
Left
Enter the distance in inches (or the default measurement for your report) that you want the paragraph to be indented from the left margin of the page. 
Right
Enter the distance in inches (or the default measurement for your report) that you want the paragraph to be indented from the right margin of the page. 
Line Spacing
Enter the spacing you want for lines as a multiple of the font size you are using, or as an exact number of points. 
Of
Use this box to enter the multiple that you want to use (if you selected Multiple for Line Spacing), or the number of points (if you selected Exact for Line Spacing). 
Reading Order
Use the options in this area to define whether your text is to be read from left to right or from right to left. 
Text Interpretation
Use this list to select the type of pre-formatted data (string or memo fields only) or text you are inserting in a field. Crystal Reports extract information about the font, size, style, color, and paragraph and displays the data or text with the specified attributes. 
Number

If you select a numeric field to format, the Format Editor offers these options on the Number tab.

System Default Number Format
This option checks the settings in your Windows control panel and uses those settings for your numeric fields.
Currency Symbol Area

This option enables you to display a currency symbol and its type, if applicable.

Customize
Use this button to see more detailed formatting options on the Custom Style dialog box. 
Date and Time

If you select a Date, Time, or DateTime field to format, the Format Editor offers these options on the Date and Time tab.

Style
From this predefined list, choose a date/time style to apply to the field selected on your report. When you choose System Default Long Format or System Default Short Format, the program uses the time and date formats from the Regional Settings Properties dialog box in the Windows Control Panel. 
Customize
Use this button to see more detailed formatting options on the Custom Style dialog box. 
Boolean

If you select a Boolean field to format, the Format Editor offers these options on the Boolean tab.

This list includes all the formats in which Boolean fields can be displayed. Select the desired format from this list. 

Hyperlink

Use this tab to create a hyperlink to a web site, an e-mail address, a file, or a report object. The hyperlink is saved with your report and is available to other users as a way of viewing additional information. 

Hyperlink type
Click the type of hyperlink you want to create. Hints about how to use each option are provided on the bottom of the tab in the "Helpful hint" section.
Hyperlink Information
Use this section of the tab to enter the appropriate hyperlink information (the URL of a web site, for example).Hyperlink information is available for all Hyperlink types except No Hyperlink,Current Website Field Value, and Current E-mail Field Value.
Browse
Use Browse to search for files using the Open dialog box. Browse is available only for the "A File" option. 
Helpful hint 
Use these hints to learn how each Hyperlink type works and what it will add to your report. 

Text Objects and Labels

Text objects are containers that hold information. A text object can contain a character, words, or a paragraph.

Text objects and the elements inside them can then be independently formatted with fonts, color, and tabs.

To display a title or a label on your report, create a text object.

Hint

When you have completed any editing changes, do not press Enter to end the process. This action inserts a new line inside the text object. Click outside the text object to finish the editing process.

Text objects can be modified by double-clicking the text object or using a Right-click using the shortcut menu.

Combining Fields with Text Objects

Embedding a Field into a Text Object

To print text and field information together, you embed the data into a text object. For example, you might want to create a form letter with the beginning "Dear Mr. Smith", where "Mr." and "Smith" are two different fields in the data source, and you manually add the salutation.

If you were to put these three fields into a text object (separated by a space), Crystal Reports joins them together:

  • Mr. Paul Smith

  • Ms. Elaine Jones

  • Ms. Carol Smith-Jones

Hint
While modifying the text object, drag and drop the field into the text object to the desired position. Do not let go of the mouse button until the vertical insertion line is in where you want the field to print.
Note
Embedding a text object within another text object is not possible.

Multiple Objects Formatting

Use the Format Painter to copy formatting properties from one report object to one or more target objects. The Format Painter button displays on the Standard toolbar when you select a source object in your report. If you apply formatting to a target field that is not the same as your source field, then only the common properties are applied.

Play the following video to see how to use the Format Painter

Some things to keep in mind about the Format Painter:

  • The Format Painter does not copy hyperlink information to a target object or field.

  • The Format Painter does not copy formatting that is applied through use of the Highlighting Expert.

  • The Format Painter does not copy formatting from text or template objects to database fields.

  • When using a Date and Time field as your source, a target field’s date or time properties are changed; the reverse is also true (that is, a Date field or a Time field used as your source also affects the date and time properties of a Date and Time field).

  • This table lists the source report objects and fields and the applicable targets you can use with the Format Painter.

Note
  • The Format Painter button is not available until you select an object or field.

  • Click the button a second time, or press ESC, to exit the Format Painter.

  • You cannot apply formatting to read-only objects or fields.

  • Hold the Alt key down if you want to apply formatting to more than one object or field.

Source Report Objects and Fields and Applicable Targets for Format Painter

Source object or fieldTarget object or field
Report field (not in a cross-tab)Report field (not in a cross-tab)
Report field in a cross-tabReport field in a cross-tab
Template fieldTemplate field
Text object (not in a cross-tab)Text object (not in a cross-tab)
Text object in a cross-tabText object in a cross-tab
Object in an OLAP grid headerObject in an OLAP grid header
Line objectLine object
OLE or BLOB fieldOLE or BLOB field
SubreportSubreport
Chart, map, OLAP grid, or cross-tabChart, map, OLAP grid, or cross-tab

Text Rotation

Use the Text Rotation to vertically align the fields and text-based objects on your report.

The degree of rotation options are:

  • 0 degrees: default setting.

  • 90 degrees: direction of text is bottom to top, left to right.

  • 270 degrees: direction of text is top to bottom, right to left.

The Report Explorer

The Report Explorer appears when you select the Report Explorer command from the View menu, or when you click the Report Explorer button on the Standard toolbar. The Report Explorer displays a tree view of the sections in your report and lists the report objects contained in each section. The Report Explorer works like a "report navigator," so you can work with report objects directly from the explorer.

The Report Explorer Toolbar

The Report Explorer's toolbar provides buttons that let you expand or collapse your report's tree view and choose the report items to display by type:

Expand
Use this option to expand all child nodes of the tree view under the selected node. If you select this option while the root node is highlighted, all remaining nodes are expanded. If you select this option while a child node is highlighted, only the nodes that are part of the child are expanded.
Show/Hide Data Fields

Use this option to show or hide data fields in your report. Data fields include formula fields, summary fields, and text objects.

Show/Hide Graphical Objects

Use this option to show or hide graphical objects in your report. Graphical objects include charts, maps, boxes, lines, BLOB fields, and OLE objects.

Show/Hide Grids and Subreports

Use this option to show or hide cross-tabs, OLAP grids, and subreports in your report.

Using the Report Explorer

The content of the Report Explorer represents the content of the report in a tree view. The root node is the report itself, while the first-level nodes represent the report's sections.

Within each section, the report's fields and objects are listed. Any item that you select in the tree view is selected in the report (in either Design or Preview modes). You can modify report fields and objects by selecting them in the Report Explorer. When you right-click the selected item, you see a menu that contains the actions you can carry out on the item.

For example, if you right-click a text object, the menu contains the options to edit the text, to format its font or color, and so on. Likewise, if you right-click a section node, the menu contains the options to hide, suppress, and format.

Play the following video to learn how to navigate using the Report Explorer

Note
  • You can select multiple fields for formatting by using Ctrl-click; however, you cannot add additional fields or report objects when using the Report Explorer, but you can delete them.

  • Items with hyperlinks are shown as blue text with a solid underline. Items with Report Part hyperlinks are shown as green text with a dashed underline. These indicators are available if you are using a Microsoft Windows operating system only.

Log in to track your progress & complete quizzes