Programatically Generate documents with Enterprise Architect
Enterprise Architect is a tool for architecture modelling at base, but can be used for much more.
What the tool can improve is the way to generate documents based on the AutomationInterface.
There are two ways to generate documents in EA Sparx:
- DocumentGenerator
function createDocument( docName, docPath )
{
var Gentor as EA.DocumentGenerator;
Gentor = Repository.CreateDocumentGenerator();
Gentor.NewDocument("Glossary");
Gentor.InsertText( "Hello World" +"\n","Heading 1");
return Gentor;
}
createDocument ("yourDocName", "yourDocPath");
- Virtual Document
This option is based on this link from Bellekens but adapted. The code below calls RunReport that runs the F8 (or generate documents) document generation option.
!INC Local Scripts.EAConstants-JScript
function main()
{
Session.Output("Hello World");
var prj = Repository.GetProjectInterface();
prj.RunReport("{GUID}", "test","C:\\diagram_export\\3.rtf");
Session.Output("Bye World");
}
main();
Leave a Comment