FormattedRecordArea
The FormattedRecordArea layout element allows adding formatted text to a report.
The FormattedRecordArea element allows adding formatted text to a record area, which included HTML formatting elements embedded in the text. It also allows adding data from text or a field dynamically at runtime anywhere in between text. Add this layout element to a page or a report section's header, detail or footer. To embed JSON data, specify the field name between #...# and it populates the value at runtime.
Refer to designer-usersguide-examples for a GitHub example.
Add a FormattedRecordArea by right-clicking and selecting Add Formatted Record Area from the context menu.
Figure 1. Add a FormattedRecordArea by selecting Add Formatted Record Area from the context menu.
Text Example
For example, Dear #FirstName# #LastName#,
in the JSON
The # symbol is a reserved character that is used to distinguish field names from static text. Hence, static content in FormattedRecordArea should not contain # symbols other than to specify field names. For example, the following string will cause an error because the first # symbol is a part of static content.
# of items in queue are #quantity#
Removing/replacing the first # symbol in static content as shown below will resolve the error. Alternatively, you could also escape the # sign by using another # sign, for example:
## of items in queue are #quantity#
Figure 2. Adding HTML text to a FormattedRecordArea layout element.
Figure 3. Adding a JSON field to a FormattedRecordArea layout element.
The FormattedRecordArea can be resized or repositioned using the mouse, manually changing the values in the properties window or by changing the values directly in the source.
If you need to display a # as a character, then you escape it by using two ##. For example, to display "Work Order #:" in the resultant PDF, you would use enter Work Order ##:
as the text in the text property.
If your JSON dataset contains a field name with a dash or begins with a number, then you must surround the field name with square angle brackets. For example a field name of: field-one
is written #[field-one]#
in the text
property's value.
The FormattedRecordArea element has the following properties.
Properties
Property | Value | Description |
---|---|---|
leading | numeric | A value indicating the leading of the text. |
leadingType | atLeast , auto , exactly | A value indicating how the leading is calculated. |
align | numeric | A value indicating the alignment of the FormattedRecordArea. |
cleanParagraphBreaks | true , false | |
indent | numeric | A value indicating the first line indentation of the paragraph. |
leftIndent | numeric | A value indicating the left indentation of the paragraph. |
preserveWhiteSpace | true , false | |
rightIndent | numeric | A value indicating the right indentation of the paragraph. |
spacingAfter | numeric | A value indicating the spacing after the paragraph. |
spacingBefore | numeric | A value indicating the spacing before the paragraph. |
color | See Colors Users Guide topic. | A value indicating the color to be used for the font. |
face | enumeration (see below) | A value indicating the font family to be used. |
size | numeric | A value indicating size of the font to be used. |
text | text | A value indicating the text of the FormattedRecordArea. |
vAlign | bottom , center , top | A value indicating the vertical text alignment. |
id | text | A value indicating the programmatic identifier of the FormattedRecordArea. |
angle | numeric | A value indicating the number of degrees to rotate the FormattedRecordArea. |
expandable | true , false | A value indicating if text area can be expanded or not. |
height | numeric | A value indicating the height of the FormattedRecordArea. |
splittable | true , false | |
width | numeric | A value indicating the width of the FormattedRecordArea. |
x | numeric | A value indicating the X coordinate of the FormattedRecordArea. |
y | numeric | A value indicating the Y coordinate of the FormattedRecordArea. |
Face property
The face property specifies the initial font used in the document. You can use HTML tags to customize how you use fonts within the text.
Figure 5. The face properties supported fonts.
Note on cleanParagraphBreaks Property
The cleanParagraphBreaks property being set to true
will only have any affect on the FormattedRecordArea if the splittable property is also set to true
. In other words the paragraph will not break at all (and therefore never needs to consider the type of break) if the splittable property is set to false
. If however CleanParagraphBreaks is set to true
and splittable is also set to true
the will take care to make sure that any splitting performed on the FormattedRecordArea will always result in at least two lines of the paragraph being kept together (no orphaned lines). The only exception to this is if the paragraph itself is only one line then that one-lined paragraph will appear by itself.
Supported HTML Tags
The FormattedRecordArea class was designed to allow formatting within a paragraph of text using common and familiar HTML-style tagging. The FormattedRecordArea is not designed to support full HTML tags but it will accept the following HTML tags and attributes. Some of the attributes are in addition to the attribute found in HTML and are used for advanced paragraph and line properties. Please note that white space can be treated literally or ignored (standard behavior for HTML).
Bold Tag
<B.. tag - Enclosed text is bold.
Font Tag
<Font ... tag - For font attributes.
Attribute | Values | Description |
---|---|---|
Color | Web Color Hex String. | Color of the text. |
Face | A string value. | The font family to use for the text. The 5 built-in font families ("Times" | "Helvetica" | "Courier" | "Symbol" | "ZapfDingbats") can be specified or additional ones can be added through the HtmlTextArea's FontFaces property. |
Size | An integer value. | Specifies the HTML font size for the text. This is mapped to a point size internally (0 = 6 points, 1 = 8 points, 2 = 10 points, 3 = 12 points, 4 = 14 points, 5 = 18 points, 6 = 24 points, 7 = 36 points). |
PointSize | A decimal value. | The size in points of the text. |
Italics Tag
<I ... tag - Enclosed text is italics.
Enclosed text is italic.
Line Tag
<Line ... tag - Enclosed text is lined.
Attribute | Values | Description |
---|---|---|
Leading | A decimal value. | The leading of the line. |
LeadingType | auto | atLeast | exactly | Specifies how leading is calculated. |
Paragraph Tag
Attribute Values Description Align left | right | center | justify Alignment of the paragraph's text. AllowOrphanLines true | false Specifies if one orphaned line on a page has to be carried to the next page by itself or it will be carried along with the previous line to make it two lines on the next page. Indent A decimal value. The first line indentation of the paragraph in points. LeftIndent A decimal value. The left indentation of the paragraph in points. PreserveWhiteSpace true | false Specifies if white space should be preserved. RightIndent A decimal value. The right indentation of the paragraph in points. SpacingAfter A decimal value. The spacing after the paragraph in points. SpacingBefore A decimal value. The spacing before the paragraph in points.
Subscript Tag
<SUB ... tag - For subscript attributes.
Attribute | Values | enscription |
---|---|---|
Displacement | A decimal value. | The positive value will move the text downwards. |
Superscript Tag
<SUP ... tag - For superscript attributes.
Attribute | Values | Description |
---|---|---|
Displacement | A decimal value. | The positive value will move the text upwards. |
Underline Tag
<U ... tag - Enclosed text is underlined.
Break Tag
<BR ...tag - Inserts a single line break.