cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Diagram API

amaglio
Retired
I need to include in a java report a Diagram object as a Jpeg image.
Do you have some example or suggestion about which API can be used ?
Thanks!
1 Reply

amaglio
Retired

For whom may be interested, I found a way to get the Jpeg diagram.

 

Java:

// get an Organizational Process
MegaObject op=oRoot.getObjectFromID("~JLDdvLAcOLwB[01_01_Financial Reporting regulation updating <EN> ]");
MegaObject diag=op.getCollection("~HIedE)fyADy0[Description]").filter("~KekPBSs3iS10[Diagram]").get(1);
if(diag.exists()) {
 MegaDrawing md=MegaServiceBuilder.getDrawingOf(diag);
 String fn="c:\\temp\\diag1.jpg";
// saveAsPicture(String FileName,int FilePictureFormat,int BitsPerPixel,int Quality,int Resolution,int Height,int Width)
 md.saveAsPicture(fn, 2, 8, 100, 10, 16000, 16000); //megaFPFjpg=2
 MegaCurrentEnvironment env = oRoot.currentEnvironment();
 env.toolkit().executeCmd(fn, "?open");
}


VB Script:

root=getroot
op=root.getObjectFromID("~JLDdvLAcOLwB[01_01_Financial Reporting regulation updating <EN> ]")
diag=op.getCollection("~HIedE)fyADy0[Description]").gettype("~KekPBSs3iS10[Diagram]").item(1)
if diag.exists then
 Set oDrawing = diag.Drawing("RO") 'Read-Only
 fn="c:\temp\diag.jpg"
'saveAsPicture(FileName,int FilePictureFormat,int BitsPerPixel,int Quality,int Resolution,int Height,int Width)
 oDrawing.saveAsPicture "c:\temp\diag.jpg", 2, 16, 1000, 1000, 15000, 15000
 Set ws=CreateObject("WScript.Shell")
 ws.run fn
end if