Text and Property

When you want to output some text, you either use a <Text> or a <Property>.

You use <Text> when you want to output specific words, sentences or paragraphs, such as "Here is a list of business activities:". The following example show the use of <Text> in a template.

<Text>Here is a list of elements in my project:</Text>
<ParagraphBreak/>
<IterationBlock allLevel="true" >
    <Property property="name"/>
    <Text> : </Text>
    <Property property="modelType"/>
    <ParagraphBreak/>
</IterationBlock>

The first <Text> in the example above outputs a sentence "Here is a list of elements in my project: ".

The second <Text> outputs a colon between the name and type of elements. Note that the space before and after the colon will get output into the document.

Here is the outcome of the example above.

Here is a list of elements in my project:
Place Order : UseCase
PaymentController : Class
Cancel Order : BPTask

The following table lists the available attributes of <Text>.

Name Description Required?
isBold : boolean
Set the text to bold. Optional
isItalic : boolean
Set the text italic.
Optional
isUnderline : boolean
Underline text. Optional
fontFamily : string Specify the name of font to apply to the text. Optional
fontSize : integer Set the font size. Optional
foreColor : color Set the color of text. Optional

alignment : string
{left | center | right}

Set the alignment of text. Optional
style : string Set the name of style. You can add and edit style in Doc. Composer. Optional
numberingLevel : short Determine the Numbering Level if the text is showing as a number or bullet list. Optional
margin The top, right, bottom, left margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>.

Example: margin="0, 0, 0, 0"
Optional
margin-top : integer The top margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>. Optional
margin-right : integer The right margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>. Optional
margin-bottom : integer The bottom margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>. Optional
margin-left : integer The left margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>. Optional
hyperlink : boolean Specify whether the text is a hyperlink or not. If true, the text will be linkable. Optional
keepWithNext : boolean Make sure the text will be shown in same page with next item. (Used for WORD document only) Optional
href : string The text will be linkable and the target will be the URL specified by this attribute. When this attribute is specified, @hyperlink will be ignored.

Example: <Text href="https://www.visual-paradigm.com">Visual Paradigm</Text>
Optional

Attributes of <Text>

You may have noticed the use of <Property> in the example above. <Property> is another way to output text. You use <Property> when you want to output text by extracting the data from a property of querying diagram or element. The following example show the use of <Property> in a template.

<IterationBlock allLevel="true" >
    <Text>Name: </Text>
    <Property property="name"/>
    <ParagraphBreak/>
    <Property property="description"/>
    <ParagraphBreak/>
    <ParagraphBreak/>
</IterationBlock>

The first <Property> outputs the name of the querying element, while the second <Property> outputs the description.

Here is the outcome of the example above.

Name: Place Order
The process to check out a shopping cart and finish the payment.

Name: PaymentController
A controller class that handles the payment logic.

Name: Cancel Order
The process to delete an order made within the last 7 days.

The following table lists the available attributes of <Property>.

Name Description Required?
property : string The property to query.

Note that if you want to query the name of wireframe widgets, use realName as value instead of name.
Required
isIgnoreHTMLFontSize : boolean Ignore the font size on the HTML text. Optional
isIgnoreHTMLFontFamiliy : boolean Ignore the font selection of the HTML text Optional
forcePlainText : boolean Force HTML text to show as plain text by removing formatting, if any. Optional
default : string The text to show when the value of property has not ever been specified. Optional
isBold : boolean
Set the text to bold. Optional
isItalic : boolean
Set the text italic.
Optional
isUnderline : boolean Underline text. Optional
fontFamily : string
Specify the name of font to apply to the text. Optional
fontSize : integer
Set the font size. Optional
foreColor : color
Set the color of text. Optional

alignment : string
{left | center | right}

Set the alignment of text. Optional
style : string
Set the name of style. You can add and edit style in Doc. Composer. Optional
numberingLevel : short
Determine the Numbering Level if the text is showing as a number or bullet list. Optional
margin The top, right, bottom, left margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>.

Example: margin="0, 0, 0, 0"
Optional
margin-top : integer The top margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>. Optional
margin-right : integer The right margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>. Optional
margin-bottom : integer The bottom margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>. Optional
margin-left : integer The left margin of a text. Note that only the first set of margin will be considered within a paragraph. The rest will be ignored. In Doc. Composer, a paragraph is ended by a <ParagraphBreak/>. Optional
hyperlink : boolean
Specify whether the text is a hyperlink or not. If true, the text will be linkable. Optional
keepWithNext : boolean
Make sure the text will be shown in same page with next item. (Used for WORD document only)
Optional
dateFormatString : string Date value property will be formatted with the format pattern specified before displaying. Formatting will only occur when the property is a date value (e.g. pmLastModified).

e.g. @dateFormatString ="yyyy-MM-dd"
Optional
typeWithFullyQualify : boolean Output the fully qualified type of querying element. For example: true to output com.vp.MyClass instead of MyClass Optional
returnTypeWithFullyQualify : boolean Output the fully qualified return type of querying element. For example: true to output com.vp.MyClass instead of MyClass Optional

Attributes of <Property>

Understanding Dynamic Heading Style

When you want to set a text produced by a <Text> or a <Property> to be a heading, add and specify the style attribute in the <Text> or <Property>.

There are two ways of specifying a heading – Static and Dynamic. The following example shows the static way of specifying heading:

<Text style="Heading 1">Text in heading 1</Text>
<Property property="name" style="Heading 2"/>

The <Text> in the example above outputs a sentence "Text in heading 1", with Heading 1 as style. The <Property> outputs the name of a model element, with Heading 2 as style.

The static way of specifying heading requires you to provide the style name in the template.

In contrast to the static way, here is an example that shows the dynamic way of specifying heading:

<Text style="@heading+">Text in heading 1</Text>
<Property property="name" style="@heading+"/>

In the example above, we do not provide the name of the heading style. Instead, we use @heading to indicate the need to assign heading style, @heading+ to indicate an increase of heading style level. By using @heading, the style Heading 1...N will be used in the output document.

Here is the outcome of the example above.

Text in heading 1
Place Order Use Case

The sentence Text in heading 1 has Heading 1 applied, while the name Place Order Use Case has Heading 2 applied.

More about Heading Increment

By appending + to @heading, the leveling of heading style will be increased. For example, if the previous heading is a Heading 1, the use of @heading+ will output a heading in Heading 2.

The use of + in @heading is optional though. If you want to add a heading that has the same heading level as the previous heading, skip + to reuse the style used by the previous heading.

Related Resources

The following resources may help you to learn more about the topic discussed in this page.

 
2. Template Root Table of Contents 4. Looping (Non Connector)
 

Technical Support

Have technical issues or suggestions? Please contact Visual Paradigm Support Team.

Sales Support

Have questions related to registration, licensing or payment? Feel free to contact Visual Paradigm Sales Team.

Discussion Forum

Share your suggestions of opinions at VP Discussion Forum.