How to Find the Property and Model Element Type Names in Editing Report Templates
Report composer is a flexible report developing tool, enabling you to control the layout of report content as well as the content to show. You can control the outcome by editing template. Yet, you may find it uneasy to read and edit a template in XML format. Here we are going to share some tips with you. In this article, we will show you how to find out the correct property (e.g. name, modelType) and model element type names (e.g. UseCase, Class) to use in a template.
Before we start, let’s take a look at a build-in template’s content. Read below the content of build-in Children template for Use Case Diagram.
This template directs the report engine to print a table. Each row in table represents a shape in diagram. The first column in table shows the name of shape while the second column shows the type of shape. Here we have a question: When I am developing my own template, how do I know the property name name and modelType (as highlighted in yellow in image)?
XML is the answer
Let’s say if we want to print out the documentation of shapes in diagram, how do I know the correct property name to use? Shall I use documentation, Documentation, doc, document or something else? Can we find out the answer without guessing?
Although Visual Paradigm does not publish the list of supported element properties and model element types you can use in editing template, you can find them out through extracting the XML content of diagrams/model elements/shapes. Let’s try together.
- Open the diagram where the shapes you want to have their information print to report exist.
- Let’s say we want to print out the documentation of shapes. Right click on any shape and select Copy > Copy as XML (Traditional) from the popup menu.
- Open any text editor and paste the copied XML content in it.
- Use the Find/Search function to locate the portion of the selected element. Enter the name of that element and start finding.
- Once you have found the model element, you can immediately tell its model element type name (e.g. UseCase) by referring to its property modelType. Note that this skill applies to all elements, not just use case.
- Under the Model element you can find a list of properties (e.g. StringProperty, BooleanProperty,etc.)of that element. Pay attention to the name property. This is what you should use as propertyText in template.
- We can see that the correct property name for documentation is documentation. Note that as long as the properties are the same, their name will be the same even the model element types are different. For instance documentation for both use case and actor both have documentation as property name.
Leave a Reply
Want to join the discussion?Feel free to contribute!