Question

Although I am using Doxygen for some years, there are lots of other methods used to create documentation: PowerPoint files, Word files, UML files. Although every file type has its advantages (e.g. PowerPoint is easy to create and ideal for presentations), this quickly leads to lots of different files, in different locations, and no overview.

I now want to merge all these files into one entry point. My idea is to use Doxygen to generate HTML files that contain the source code documentation, and to write overview documentation in Doxygen (just as Qt does), and include images based on the other files. I am also trying to automate the whole system.

What I am now looking for is a way to convert these other files to images, so my automated system can include these images in the generated HTML (and finally in the generated QCH (Qt Help) file).

For PowerPoint I found some tools, but I don't seem to get the free ones working correctly, and a trial version of a commercial one fails on some of my PPTX files.

For Enterprise Architect I didn't find a way to automate the generation of images.

Does anybody know how to automatically generate images from Enterprise Architect files and from PowerPoint files?

Was it helpful?

Solution

Found it.

Enterprise architect has a Java Archive (eaapi.jar) which you can use to access the EAP files from Java.

What you need to do is get the repository, open the file and getting all top-level packages from it (I've omitted all error handling code from this sample):

org.sparx.Repository repo = new org.sparx.Repository();
org.sparx.Project project = repo.GetProjectInterface();
repo.OpenFile(args[0]);
org.sparx.Collection packages = repo.GetModels();

Then loop over all the packages and call your own method (because you will need to call yourself recursively):

for (short i=0;i<packages.GetCount();i++)
   {
   org.sparx.Package pack = (org.sparx.Package)packages.GetAt(i);
   handlePackage (project, pack, currentdir);
   }

Then in the method, loop over all diagrams and generate the images, and loop over all sub-packages recursively:

public static void handlePackage (org.sparx.Project project, org.sparx.Package pack, String output)
   {
   for (org.sparx.Diagram diagram : pack.GetDiagrams())
      {
      project.PutDiagramImageToFile (diagram.GetDiagramGUID(), output + diagram.GetName() + ".png", 1);
      }
   for (org.sparx.Package subpack : pack.GetPackages())
      {
      handlePackage(project,subpack,output);
      }
   }

That's it.

Some pitfalls:

  • You must pass a fully qualified path to the OpenFile method. Even if the file is in your local folder, you still have to pass the full path.
  • Same for the output files
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top