To create a RichText DataWindow object:
In the New dialog box, select RichText from the DataWindow tab and click OK.
Select data for the DataWindow object as you do for any DataWindow object.
If you want data to be retrieved into the Preview view automatically, select the Retrieve on Preview check box. For more information, see “Building a DataWindow object”.
Specify settings for the DataWindow object on the Specify RichText Settings screen, click Next, and then click Finish.
Table 30-1 describes the types of settings you can make for the RichText DataWindow object in the wizard.
You can specify |
With these settings |
---|---|
Tools available to the user |
Rich text bars: Tool, Status, Ruler, and PopUp Menu |
Whether there will be a header and footer for the printed DataWindow object |
Header/Footer |
Whether users are prevented from editing input fields and text |
Display Only |
Colors for the whole background and the background of input fields |
Background Color: General and Input Field |
After you click Finish in the wizard, you see input fields with their labels in the detail band in the Design view:
You can:
Begin editing text in the detail, header, or footer bands, building a report around the input fields. You can delete, move, copy, and paste text and input fields as needed.
Include a rich text file you have already prepared. If you include a rich text file created in PowerBuilder that contains input fields, those names should match the columns selected in the DataWindow object.
For information about creating rich text files, see Application Techniques.
Add computed fields that will appear as input fields in the report and whose values come from the computed field expression.
This sample shows how you might rearrange the input fields in a sales letter:
You can add text by typing directly in the Design view. You do not have to create text objects as you do for other DataWindow object styles. The Report painter's StyleBar lets you apply formatting to selected text. The RichText toolbars are not available in the painter.
Preview mode and editing text You cannot edit text in the Preview view, but you can edit it when you preview the DataWindow object by selecting File>Run/Preview from the menu bar. It may seem convenient to edit text in Preview mode because the toolbars are available. However, any changes you make to the text when previewing are temporary. They are discarded as soon as you return to the Design view.
If you have a rich text file, you can include it in the DataWindow object. In the Design view, you can insert text from a file into the detail, header, or footer band.
To insert a file:
Click in the text in any band to set the insertion point for the file.
Right-click in the Design view and select Insert File from the pop-up menu.
In the file selection dialog box, select the file you want to insert.
Only the body of the file is used. If the file has a header or footer, it is ignored.
You decide whether your RichText DataWindow object has a header and footer by checking Header/Footer in the wizard or Rich Text Object dialog box (described in “Formatting for RichText objects within the DataWindow object”). The decision to include a header and footer must be made at design time; it cannot be changed at runtime.
To display a page number or a date in the header or footer, you can insert the predefined computed fields Page n of n or Today(). You do not need to write scripts to set the values of these fields for each page, as you do for the RichTextEdit control.