I want to know how edit settings in EA programmatically in an addin.
I already have a functioning addin, which creates a new image of the diagram each time it is changed, overwriting the old version. this is done in C# via this command:
projectInterface.PutDiagramImageToFile(GUID, path, 1);
However i want an image without padding and without the box in the upper leftmost corner, like this:
while this can be done by editing the settings, i want to persist the users settings, meaning that i will probably do the following:
so... How do i edit these settings? (preferences -> diagram -> diagram frames -> printed images AND diagram padding)
Ideas are also more than welcome :)
You can not easily achieve what you want. The flag for creating the diagram border is stored in the registry:
[HKEY_CURRENT_USER\Software\Sparx Systems\EA400\EA\OPTIONS]
"SAVE_IMAGE_FRAME"=dword:00000001
You can change this setting, but EA will only recognize the change on a restart. If you run your script from outside EA you would need to change the registry, start an EA instance, do what you need and change back the flag finally. From inside EA you're probably out of luck. (You might try out, though.)
I checked the help and for the Diagram Properties/Diagram/Hide Border it says
Click on any or all of the checkboxes to specify which saved images of your diagrams will automatically include a diagram frame around them - those saved to disk, those printed out, and/or those saved to the default system clipboard.
A diagram frame is a labeled outline around the diagram image, providing both a border and a reference.
Obviously it does not do what it says. You might report a bug.
Leaving my previous answer to avoid pitfalls for others....
Old answer - It appears that the "obvious" diagram setting will not do what it says - EAUI :-(
You need to access the tables directly.
SELECT ShowBorder FROM t_diagram WHERE Diagram_ID = <the id>
where <the id>
is the diagram ID of the diagram. It will return True
or False
depending on the current setting.
To actually change it you need to call
Repository.Execute("UPDATE t_diagram SET ShowBorder=<the altered value>")
Execute
is an undocumented but working operation which can't be avoided in cases like this where the API (again) does not provide attributes.