Combining Special Fields


You re not limited to combining database fields inside text objects. You can use special fields as well. Special fields are system-generated fields, such as the print date, print time, page number, and total page count. You may place them directly on the report, just like database fields. And, like database fields, they ll give you spacing problems if you try to place them near literal text.

To combine special fields with literal text inside text objects, perform the same steps as for database fields. Just drag the fields from the Special Fields category of the Field Explorer, instead of from the Database Field category. In fact, you can embed any type of field from the Field Explorer into a text object just by dragging and dropping from the desired category.

Figure 2-3 shows the benefits of combining special fields with literal text in text objects.

click to expand
Figure 2-3: Combining special fields inside text objects

The following pointers will help you as you combine fields and literal text inside text objects:

  • If you place a database or special field in the wrong location inside the text object (suppose you place the Last Name field in between the letters a and r in the word Dear ), you can simply use your cursor keys and the BACKSPACE or DEL key to make the correction. In this case, it is easier to just delete the text following the special field, and reenter it before the special field. You may also use CTRL-C to cut text and CTRL-V to paste text inside the text object.

  • If you inadvertently drop a subtotal , a summary, a database field, or some other item inside a text object by mistake (it s pretty easy to do, even if you re careful), you have two choices. If you catch the problem immediately, you can choose Edit Undo, or click the Undo button on the Standard toolbar. The field will move back where it was. However, if you notice that you accidentally dropped a field inside the text object after it s too late to reasonably undo it, edit the text object, click the field that was mistakenly added to highlight it, and press the DEL key. The field will be removed from inside the text object. You will then need to re-create it and place it in its correct position on the report.

The Can Grow Formatting Option

When you combine database fields or special fields inside text objects, you may often find that the text object is no longer wide enough to show its entire contents. Crystal Reports features the Can Grow formatting option that allows a text object to grow vertically, if necessary, to show its entire contents. You may choose this option, as well as change the Maximum Number of Lines option that the text object can grow from the Format Editor.

To display the Format Editor, use one of these options:

  • Select the text object and then select Format Format Text from the pull-down menus .

  • Right-click the text object and choose Format Text from the pop-up menu.

  • Click the Format button on the Expert Tools toolbar.

The Can Grow option is found on the Common tab of the Format Editor.

click to expand

With Can Grow turned on, the text object will automatically grow taller to show all the text inside it. You can specify the maximum number of lines that the text object will grow, or leave the number set to zero for unlimited size . When Can Grow is turned on, the text object will only display as wide as it appears on the report. However, it will word-wrap at spaces in the text, creating additional vertical space up to the maximum number of lines.

This automatic behavior lets you size a text object so that it s only one line high. If the contents of the text object can be displayed in one line, the text object will remain one line tall. If it needs more lines, it will expand only by the amount of vertical space necessary to show the material inside the text object (limited by the maximum number of lines).

Tip  

Can Grow is helpful for other types of objects as well, not just text objects. You can set the Can Grow formatting option for string fields and memo fields. This is particularly helpful for description or narrative types of fields that could contain as little as a few characters and as much as several paragraphs of text. Can Grow isn t available for any type of object other than a text object, string field, or memo field.




Crystal Reports 10
Crystal Reports 10: The Complete Reference
ISBN: B005DI80VA
EAN: N/A
Year: 2004
Pages: 223
Authors: George Peck

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net