Got an old module which is generates reports with data from sparx ea project.
There is a part where you need to insert diagrams as pictures in the document.
Now it looks like that
public static void copyDiagram(
EA.Diagram diagram,
EA.Repository eaRepository)
{
eaRepository.App.Project.PutDiagramImageOnClipboard(diagram.DiagramGUID, 0);
eaRepository.CloseDiagram(diagram.DiagramID);
}
copying it to clipboard, and after that there goes something like
currentDocumentRange.Paste()
Looks strange for me. I think it's not really good to use clipboard like that, so I want to rewrite it in future.
So, only other function I found there looks like that PutDiagramImageToFile(diagrammGUID, path, type)
If there are no better option is it okay to create new file, after that get it by it's path insert into word document, and then delete it?
Or, maybe there are some other SparxEA function, which get image from diagram in byte[]
format or like Image
format?
What way is better?