Book a Demo

Author Topic: Automated HTML Report - DocumentGenerator too granular  (Read 3312 times)

esscasey

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Automated HTML Report - DocumentGenerator too granular
« on: November 02, 2022, 01:59:14 am »
Hello,

I'm trying to automate the generation of an HTML report for an EA model using the C# API from EA version 16.0. What I want to do is generate model documentation automatically every night so that the docs are in sync with the current model.

I've been able to generate HTML output package-by-package using the DocumentGenerator class, but I have a couple problems/questions. First, here is the relevant code that generates the HTML:

Code: [Select]
        documentGenerator.DocumentPackage(modelPackage.PackageID, 0, "Model Report");

        for (short subID = 0; subID < modelPackage.Packages.Count; subID++)
        {
            Package subPackage = (Package) modelPackage.Packages.GetAt(subID);
            if (!documentGenerator.DocumentPackage(subPackage.PackageID, 1, "Model Report"))
            {
                    Console.WriteLine("last document error: " + documentGenerator.GetLastError());
            }

        }

        documentGenerator.SaveDocument("C:\\development\\NewEms\\ModelAutomation\\output.html", DocumentType.dtHTML);

Questions:

1. Is the for loop really necessary? Is there another method that I can call that will generate the HTML document for the entire package, similar to using Publish -> Model Reports -> HTML -> Standard HTML Report from within Enterprise Architect? I could write a recursive subpackage traversal method but I'd like to avoid that if possible.

2. The automated HTML doesn't look exactly like the HTML generated from EA. Cosmetic differences aside; a) the hyperlinks in the model diagrams aren't clickable to allow navigation from diagram-to-diagram; b) there's no browser-like frame to allow easy navigation within the HTML document.

Is there a better/simpler way to accomplish my goal?

Thanks in advance,

Casey


Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Automated HTML Report - DocumentGenerator too granular
« Reply #1 on: November 02, 2022, 09:32:17 am »
Hi Casey,
We use ProjectInterface.RunHTMLReport(...) to export the branch.

Example:

      ProcessHTMLBranch = oProjectInterface.RunHTMLReport(HTMLBranchUUID, exportPath, ".png","<default>", ".htm")

To ensure a specific "top" diagram, we open that, just before generating.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

esscasey

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Automated HTML Report - DocumentGenerator too granular
« Reply #2 on: November 03, 2022, 07:41:42 am »
Thank you Paulo! That was exactly what I was looking for.

wivel

  • EA User
  • **
  • Posts: 243
  • Karma: +12/-1
  • Driven by Models
    • View Profile
Re: Automated HTML Report - DocumentGenerator too granular
« Reply #3 on: November 03, 2022, 08:22:38 am »
To ensure a specific "top" diagram, we open that, just before generating.
HTH,
Paolo
It would be nice it the RunHTMLReport function could take the GUID/ObjectID of the diagram you would like to have as default, as parameter.

Henrik