Page tree

MagicDraw 2021x Documentation


On this page

Note

In this version, Document Report Designer diagram supports only the diagram for making the Microsoft Word document (DOCX) template.

Using the Document Report Designer diagram

In this section, you will learn how to create the Document Report Designer diagram and generate it to a DOCX template that you can add in Report Wizard for generating reports later.


To create the Document Report Designer diagram and generate it to a template


  1. Right-click a Package in the Containment tree, select Report Designer Diagrams > Document Report Designer Diagram.



  2. Create diagram elements in the working area of the diagram and specify values.
  3. Arrange diagram elements as desired.



  4. In the Containment tree, right-click Document Report Designer Diagram  and select Generate Template to generate the template.

    Note

    Only symbols of elements on the diagram are used to generate the code template. Other elements in the Containment tree are not used to generate the code template.



  5. Refine more layout, style, and code logic in Microsoft Word.

  6. Add the complete template to Report Wizard.

  7. Generate the report from the added template.

Diagram elements

Document Report Designer diagram provides many diagram elements represented in Velocity syntax/directive.

Text Box

Text Box represents free, uninterpreted static-text area in which you can type anything in single or multiple lines, from plain-format text to Velocity code, one element per paragraph. You can also place Text Box anywhere.

Text Box for holding text to be typed in.

Report Data Variable

Report Data Variable represents a variable of an existing Report Data model in a project. When you create the element in the diagram, the Report Data Variable dialog opens to select Report Data and select the variable of that Report Data.

Note

Only Report Data in the Containment tree are supported.

Report Data Variable and its dialog for selecting Report Data and their variables.

Element Box

Element Box is represented as #foreach directive for fetching a collection of elements. After creating the Element Box in the diagram, you need to select an element type in the Select Element dialog, e.g., the statement for selecting a Class element is #foreach($class in $Class).

Element Box for fetching a collection of elements.

Page Box

Page Box is represented as #forpage directive for fetching a collection of elements in each document page. After creating the Page Box in the diagram, you need to select an element type in the Select Element dialog. The statement for the PageBox element is #foreach($class in $Class).

Page Box for fetching a collection of elements in each document page.

Property Box

Property Box provides a way to get an element property. You can place this element in Element Box, Page Box, and Condition Box that is contained in Element Box. The property of owner's scope element will be listed in Property Box, by which the user selects the property to show in the group.

Note

  • If the property value is a single item, the value will be printed in a single row, e.g., $class.name or $class.isActive.
  • If the property value is a collection, the value will be printed in multiple rows, e.g., #foreach($member in $class.member).

Property Box for obtaining an element property.

Element Table

Element Table is represented as #forrow directive for fetching a collection of elements in tabular form. After creating the Element Row in the diagram, you need to specify an element type as well as column number and row number in the Element Table wizard dialog. You can also add more lines and rows and create the header and border for the table.

Element Table for fetching a collection of elements in tabular form.

The Element Table wizard dialog.

Note

When you are back to update the element type, column number, or row number in Step 1, the table in Step 2 will be recreated with the blank content.

In Step 2 of the Element Table wizard dialog, the blank table is created where you can directly enter and edit text and Velocity code in the table cell. You can also press CTRL + SPACE to open the Property Guide pop-up dialog. Press CTRL + SPACE again to navigate you to Report Data Variables and Helper Tools. In this dialog, it guides you to available properties that you can select for the cell.

The Property Guide pop-up dialog.

You can insert or delete columns and rows by right-clicking a cell to open the context menu.

The context menu for inserting and deleting rows and columns.

After creating the Element Table, you can open the Element Table wizard dialog again for updating the Element table through the smart manipulator button or the Element Table editing context menu.

Property Table

Property Table is represented as #forrow directive for fetching a collection of property elements in tabular form. You can place this Property Table in Element Box to open the Property Table wizard dialog to select the property scope of the Table element in the Specification dialog, e.g., the statement for selecting the member property of the Class element in the first row is #forrow($member in $class.member)$member.name#endrow. You can also add more lines and rows and create the header and border for the table (see the detail in Element Table).

Property Table and the Property Table wizard dialog for selecting the property scope of the Table element.

Include

Include is represented as #include and #includeSection directives for including content or a document to the template. Creating the element in the diagram opens the Include/IncludeSection dialog. After selecting the document, $import.include(<document_name>.docx) is created. There are two options to select an included document: File and Attached File.

Note

If you enter a section name in the Section box, $import.include(<document_name>.docx, <section_name>) will be created instead.

Include for including content or a document to the template.

The Include/IncludeSection dialog for file or attached file selections.

Condition Box

Condition Box is a container element for storing #if, #elseif, and #else directives. Creating the element in the diagram opens the Condition dialog. You can enter conditional statements into the statement fields. To guide available properties, you can type a dot (.) and press CTRL + SPACE.

Note

  • The #if statement is required for each Condition Box.
  • If you want to add more #elseif statements, you can add them by entering more conditional statements.
  • If you want to add an #else statement, select the Add #else option.

Condition Box for storing #if, #elseif, and #else directives.

The Condition dialog for entering conditional statements into the statement fields.

Page Break

You can place the Page Break element on the diagram to be in the template to start a new page.

Page Break for starting a new page.

Helper Tool

Helper Tool are a collection of utilized functions for helping create templates. Creating the element in the diagram opens the Helper Tool dialog. You must select or search for a purpose of the function in the list to display the function description.

Note

If the returned object is a collection of functions, select the Create this function in #foreach directive option.

Helper Tool as a collection of utilized functions for helping create templates.
  • No labels