Sparx Systems Forum

Enterprise Architect => Suggestions and Requests => Topic started by: Vv on January 16, 2009, 02:02:22 am

Title: Java API : Diagram Export Problem
Post by: Vv on January 16, 2009, 02:02:22 am
I try to export a Diagram from EA to a bmp file.
I do like this:

Code: [Select]
Repository r = new org.sparx.Repository();
r.OpenFile("D:/Projets/toto/ea/ProjetToto/toto.eap");
Project project = r.GetProjectInterface();
String str = "{17F0F0FF-4F26-4b6d-8FC7-7456AACD7BF1}"

String image = project.ExportPackageXMI(str, EnumXMIType.xmiEADefault, 1, 1, 1, 1,"myPicture");
System.out.println("Ecriture de l'image :"+image);

I can't find any picture and variable 'image' is empty.

Could you help me?
Title: Re: Java API : Diagram Export Problem
Post by: Eve on January 16, 2009, 09:03:59 am
Try replacing "myPicture" with a full path.  But remember that this function is saving an XML file, so something along the lines of "C:\Images\Package.xml".  You probably have a file "myPicture" in the directory EA was started from with bitmaps sitting next to it.

The return value gives an error string, so at least I can say that the package does exist.
Title: Re: Java API : Diagram Export Problem
Post by: Vv on January 16, 2009, 09:56:49 pm
is it possible to export just one diagram in a bmp, jpg file?
Title: Re: Java API : Diagram Export Problem
Post by: Eve on January 19, 2009, 08:01:50 am
Project.PutDiagramImageToFile (http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/project_2.html)
Title: Re: Java API : Diagram Export Problem
Post by: Vv on January 19, 2009, 08:13:36 pm
OK it's working. Thanks for all