Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: andrew.francis on December 17, 2025, 12:12:59 am

Title: Document Generation - how to get elements on a diagram to nest
Post by: andrew.francis on December 17, 2025, 12:12:59 am
I am generating a virtual document using 'Model Documents' and custom templates, and I want the diagram elements in the published document to be nested in the same way as they are in the Project Browser, but they just export as a flat list. Is there a way to get the generated document to follow the package browsers structure?

I could drop the package containing the elements onto a separate Model Document, but this would mean lots of model documents and lots of templates...

The elements are of the same type, so I don't think I could apply a filter, and again this would need another template.

Thanks in advance
Title: Re: Document Generation - how to get elements on a diagram to nest
Post by: Geert Bellekens on December 17, 2025, 01:09:40 am
You either work with the child-packages/child-elements in your template, or you define the structure yourself using Model Documents.

In some cases I have created multiple copies of the same template, but with a different heading level.
A bit annoying, but only a one-time effort.

Geert
Title: Re: Document Generation - how to get elements on a diagram to nest
Post by: Sunshine on December 20, 2025, 10:37:50 am
Unfortunately if you are generating text within the diagram it will come out flat.
If I want to create a diagram followed by headers and text that is hierarchical I'll create two templates. One for the diagram and another for the text that describes each element. I'll usually have three items in my virtual document. An artifact that contains introduction, model document for diagram template and model document for descriptions.
I did discover that you can create and artifact and within that you can drag and drop diagrams and packages using templates. You can then just go in and do an update later to re-generate. It does reduce the number of model documents but not the templates.