Output Element’s Layer Information using Doc. Composer
In Visual Paradigm you can put your diagram elements into different layers. This allows you to partition your diagram data into different levels and present them only when needed. Starting from version 16.1 build 20200630ax Visual Paradigm now support output element’s layer information into document. In this article we will teach you how to create custom template to output this information.
Assume we have a diagram like below. This diagram contains two layers. The ArchiMate Application Component G is contained in both layers L1 & L2. There are another two ArchiMate Application Component A & B which only exist in layer L1 or L2 respectively.
To output element’s layer information:
- Go to Tools > Doc. Composer.
- Select Build Doc. From Scratch.
- Select the diagram we created (in our case it is an ArchiMate diagram).
- Right click on any template in Template pane and select Duplicate from popup menu.
- Name the template as Element Layer Name.
- Replace the content of template as follow.
<?xml version="1.0" encoding="UTF-8"?> <AnyBaseInitiationBlock> <Inline template="Basic"/> <IterationBlock> <Sortings> <Sorting by="modelType"/> </Sortings> <Inline template="General/Element Basic"/> <ForEach property="layerNames" ignoreLastSeparator="true"> <Property property="name"/> <Text>, </Text> </ForEach> <ParagraphBreak/> </IterationBlock> </AnyBaseInitiationBlock>
- Press OK button and close the Edit template dialog.
- Drag the Element Layer Name template into document editor.
Now the name of the layer containing the elements in selected diagram are being listed out.
Explanation of the Template
This template is start from calling the built-in Basic template to output the general information of a diagram, including its name and image.
<?xml version="1.0" encoding="UTF-8"?> <AnyBaseInitiationBlock> <Inline template="Basic"/>
Next we loop through all elements in the diagram according to their model type and output its basic information. Again it reuse the General/Element Basic template for outputting the information.
<IterationBlock> <Sortings> <Sorting by="modelType"/> </Sortings> <Inline template="General/Element Basic"/>
Now we retrieve the layerNames property of the element as a collection and walk through the item using the ForEach loop, and then output its name into document.
<ForEach property="layerNames" ignoreLastSeparator="true"> <Property property="name"/> <Text>, </Text> </ForEach> <ParagraphBreak/>
Related Know-how |
Related Link |
Leave a Reply
Want to join the discussion?Feel free to contribute!