How to automate the generation of HTML output in Enterprise Architect

11,139

Solution 1

I'm afraid you will need to write some code, but it shouldn't be more than a dozen lines or so. The function you will want to call is Project.RunHTMLReport() - a quick search for "RunHTMLReport" in the EA help file will tell you what parameters it needs, and a search on the Sparx website forum will find you an example or two.

Solution 2

Thanks chimp, It was easier than I thought. In Java:

class EADump
{
    public static void main(String[] args)
    {
     org.sparx.Repository r = new org.sparx.Repository();

     System.out.println("Repository: " + args[0]);
     System.out.println("Package:    " + args[1]);
     System.out.println("Output:     " + args[2]);
     r.OpenFile(args[0]);
     r.GetProjectInterface().RunHTMLReport(args[1], args[2], "GIF", "<default>", ".html");
     r.CloseFile();
    }
}
Share:
11,139

Related videos on Youtube

Fabio Ceconello
Author by

Fabio Ceconello

Updated on April 15, 2022

Comments

  • Fabio Ceconello
    Fabio Ceconello about 2 years

    Enterprise Architect has a way to generate the documentation in HTML/RTF/etc. that you could publish, but you have to use its GUI to do that manually. When you have your *.eap files in a CVS/Subversion server, it would be useful to have a script that would check out daily the latest version and publish it in a web server. As long as I know, EA doesn't have a command line utility for this purpose. I found that you can automate almost anything using its COM interface, but that means it's necessary to write a small program to do that. Any ideas about the easiest/cleanest way to do that (without having to write code, if possible)?

  • Fabio Ceconello
    Fabio Ceconello over 13 years
    From stackoverflow.com/users/486534/jeff: The 1st arg is the PackageGUID how do you return that? Where does that parameter come from?
  • Fabio Ceconello
    Fabio Ceconello over 13 years
    One thing I just noticed: if the EAP file or the package doesn't exist, RunHTMLReport will not tell you: no error message, no exception, nothing. Also, it seems not to like relative paths. Finally, the last arg (output) is a path. If you provide a path that doesn't exist or isn't valid, it'll silently do nothing, too.
  • Pedro Dusso
    Pedro Dusso almost 11 years
    In EA right: "To obtain the GUID, right-click on the diagram, package or element in the Project Browser and select the Copy Reference context menu option."
  • Pedro Dusso
    Pedro Dusso almost 11 years
    Well, I'm still getting a "Encountered an improper argument." mesage. Any idea?
  • Pedro Dusso
    Pedro Dusso almost 11 years
    Well, I was missing the "{}" around the Package GUID... It must be with them - "{E9EB7335-C586-4bc2-84E8-CFAD6A856362}".
  • Anttu
    Anttu over 9 years
    Anyone tried to run this as a scheduled task? Seems quite impossible. There's a whitepaper explaining how to run it as an interactive service, but I want to run it completely unattended from a scheduled task when the user it runs as is not logged in.